Operating System:

A Basic Understanding

Course Introduction

The course of Introduction to Operating System (Summer,2014) is to offer students an overview of what an OS is, what its function is and how it works.

OSes abstract away as many hardware details as possible, and present users and developers a simple and consistent interface instead. So that programmers don't have to concern details about memory, hard disks, network cards, video hardware, etc. And OS has to do all this as transparently, fairly, and as efficiently as possible. These requirements render the design and implementation of OS a challenging problem.

The course serves as an introduction to OS, and covers the basic concepts of OS, including: processes, threads, virtual memory and filesystems.Labs are also designed to reinforce above topics, including installing a Ubuntu in a Virtual environment, producing processes with system calls, practicing synchronization with threads, etc. It is expected that students will have a good understanding with basic OS principles and system programming after this course.

Course Design

This course altogether has 10 lectures and covers topics like processes/threads, scheduling, virtual memory, synchronisation and deadlock and filesystem.

Lecture1: Introduction

This chapter illustrates the purposes/functions of an operation system, its short but inspiring history, an overview of the hardware of an operating system, some essential concepts in OS and how the C programming language world works.

Important concepts include: batch system, time-sharing system, concurrency, parallellism,

Lecture2: Processes and Threads

This chapter illustrates the most central concepts in any operating system: process. A process is an abstraction of a running program. Everything else hinges on this concept. Processes support the ability to have (pseudo) concurrent operation with only 1 CPU. Without process abstraction, modern computing could not exist.

Important concepts include: process state, process lifecycle, thread usage, kernel thread, user space thread

Lecture3: Interprocess Communication

Processes need to comunication with each other.Problems here are: how one process can pass information to another; hwo to make sure two or more processes do not get in each other's way; how to ensure the dependency between processes

Important concepts include: race condition, critical region, mutual exclusion, P(down), V(up), semaphore, conditional variable, reader-writer problem, produer-consumer problem, dinning philosohper problem

Lecture4: Process Scheduling

How to ensure fairness, responsiveness by process scheduling, and satisfy different requirement of different types of tasks.

Important concepts include: responsive time, turnaround time, throughput, first come first serve (FCFS), shortest job first(SJF), Round-robin(RR),priority shechduling, multi-queue (feedback), priority inversion problem, ceiling protocol

Lecture5: Memory Management

Main memory is an importan resource that must be carefully managed. To privide economical and efficient memory service, people presented the concept of a memory hierarchy. To manage the memory, memory manager has to track the usage of parts of memory, allocate/deallocate memory, etc. Based on locality principle, people also proposed the concept of virtual memory, through which great performance improvement as well as a series of new concepts are introduced.

Important concepts include: memory hierarchy, address space, virtual memory swapping, paging, page tables, page replacement algorithm, Not Recently Used Page Replacement algorithm, First-in first-out algorithm, second-chance page replacement algorithm, clock page replacement algorithm, least recently used replacement problem, WSClock replacement

Lecture6: Deadlock

To avoid race conditions, processes have to wait sometimes. However, if there are circular waiting, deadlock will happen.This chapter will look at several kinds of deadlocks, how they arise, and how to prevent or avoid them. A classic algorithm for deadlock prevention: banker's algorithm is introduced.

Important concepts include: preemptable and nonpreemptable resources, deadlock,conditions for banker's algorithm

Lecture7: Filesystem

All computer system need to store and retrieve information. Magnetic disks have been used for years for long-term storage. The problem is: how to find information, how to keep one user from reading another user's data, how to track free blocks. An important abstraction: the file is introduced in this chapter. We will also discuss a filesystem ext2 for more details.

Important concepts include: file system layout, inode, filesystem types, FAT, ext2

Labs

  • 2014 Summer Lab Schedule
  • August 19, 21,23,25,27
  • Lab1: get to familiar with ubuntu

  • This lab is to install and experience with a linux system, Ubuntu in VmWare.First install VmWare software provided by TA. Open the .vmx file with Vmware,you can experience with the linux-style system.

    After system starting, check whether the system works correctly. Use command lines, and try commands like ls, cd, sudo.

    Note: since Operating Systems procedes before C and Data Structure, it is strongly recommended that student make sure they have GCC and corresponding work environment installed on their virtual machine.

  • Lab2: try processes
  • In this lab, you will have experiences with process creation. You'll learn how to spawn processes and execute completely different programs. First, a word of caution, when you begin with your program, it is possible that your program creates processes uncontrollably over and over, eventually causing your system to crash, for which you have to reboot your system. It is also possible that your program may create extra processes that persist after the parent processes has finished. Use "ps" command to detect this situation, and "kill" to clean up. .

  • Lab3: pthreads with locks
  • This lab will acquaints you with threading basics. The threading system will be used is the standard pthreads package. pthreads is standard on Unix/Linx systems, and because C doesn't contain any intrinsic threading primitives, pthreads is just a library of fucntions that interfaces to OS syscalls for creating and destroying threads. Because pthreads is a separate library, when use gcc, -lpthreads flag must be used. For example, if your source file is named thread.c, then you have to complie it so: gcc thread.c -o thread -lpthread Additionally, you will need to include the pthreads header file pthread.h. .

  • Lab4: file
  • This lab is to exploit into an early official filesystem used in Linux :ext2. ext2 was phased out because it has relaibility problems. However, it is appropriate for teaching.

    In this lab, you will work out several C files to exploit a real ext2 filesystem, and have an experience with the implementation of the filesystem concepts.

Slides