Midterm Review. CSE 120: Principles of Opera=ng Systems. UC San Diego: Summer Session I, 2009 Frank Uyeda

Size: px
Start display at page:

Download "Midterm Review. CSE 120: Principles of Opera=ng Systems. UC San Diego: Summer Session I, 2009 Frank Uyeda"

Transcription

1 Midterm Review CSE 120: Principles of Opera=ng Systems UC San Diego: Summer Session I, 2009 Frank Uyeda

2 Course Content Role of an Opera=ng System Concurrency and Synchroniza=on What are the challenges to support mul=tasking? Midterm CPU Scheduling Who gets the CPU and when do they get it? Memory Management How do programs share finite memory? File Systems and Storage Management How is data stored and what happens when things fail? Selec=on of Special Topics (=me permipng) Security, Virtual Machine Monitors,.. 2

3 Computer Organiza=on Monitor Scanner Keyboard Printer Disk drive CPU Video controller USB controller Disk controller System bus Memory 3

4 What is an Opera=ng System? Abstrac=ons to ease applica=on development Manage resource access among applica=ons Applica=ons VM Opera=ng Systems ) Hardware 4

5 Types of Hardware Support Protec=on OS wants to control hardware access OS wants to keep par=cular data (registers, memory) private and isolated Event handling OS needs to be aware of external events OS needs a way to respond to external events Performance improvements Commonly used thread synchroniza=on primi=ves Memory access / Disk access speed ups 5

6 Suppor=ng Privileged Instruc=ons How does an OS or CPU use protec=on levels? There is a special register on the CPU indica=ng the mode CPU checks mode bit when execu=ng privileged instruc=ons User programs execute in user mode OS executes in kernel mode For now, think of the kernel as equivalent to an OS 6

7 Events Two types of events Interrupts: caused by external event Excep=ons: caused by an instruc=on Events can be: Unexpected Deliberate Unexpected Deliberate Excep1on (sync) Fault Syscall trap Interrupt (async) Interrupt Soaware Interrupt 7

8 Handling Interrupts Polling Kernel busy waits for signal Note: textbook uses slightly different defini=on and dis=nguishes it completely from IRQ Can be inefficient depending on frequency Interrupt Handler Interrupt causes processor to trap into kernel Kernel invokes appropriate interrupt handler Interrupt handler saves process state, processes interrupt, restores state and returns 8

9 System Calls Applica=on invokes a system call to execute a privileged opera=on Raises an excep=on, which invokes kernel handler Passes parameters to handler Predefined System Call code, any other arguments Kernel handler does the rest saves caller context (state) calls proper system call rou=ne restores called state and returns 9

10 Concurrency Uniprogramming OS runs a single job un=l it is completed. Mul=programming OS has a queue of jobs Selects one job to run If the job has to wait for I/O or has run for awhile, the OS saves its state and puts it back into the queue. Repeat last 2 steps un=l all jobs complete. 10

11 Process A process is the chosen OS abstrac=on for a job/task Unit of execu=on Unit of scheduling Unit of accoun=ng A process is the instan=a=on of a program All processes are associated with a program A program or applica=on can have mul=ple processes 11

12 What is in a Process? Program Informa=on Address space, Code, Data, Stack, Registers (SP, PC, FP,..) Opera=ng System resources Open files, open network sockets Execu=on state Running: currently using the CPU Ready: ready to use the CPU (wai=ng for it) Another process has CPU Wai=ng: wai=ng for an event (not the CPU) such as I/O Cannot make progress un=l signaled 12

13 Context Switch Two processes: P 0 and P 1 The OS consumes a fair amount of processing =me This =me is referred to as context switching overhead Too much context switching overhead is a bad thing (why?) Note: image courtesy of Silberschatz,

14 Scheduling Queues The OS keeps track of non running processes in scheduling queues Ready queue Firefox PCB X Server PCB Idle PCB head tail Disk I/O PCB head tail Emacs PCB Bash PCB Terminal PCB There may be many wait queues see Nachos.threads.ThreadedQueue 14

15 Process Crea=on in Unix fork() system call is used to create a new process int fork() Creates and ini=alizes a new PCB Creates a new address space Fills child s address space with a copy of the parent s en=re address space Ini=alizes kernel resources to point to parent s Puts PCB on the ready queue So..how do we know which one is which? Each process has a different PID fork() returns twice: child s PID to the parent 0 to the child 15

16 Unix fork() example int main(int argc, char *argv[]) { char *name = argv[0]; int child_pid = fork(); if (child_pid == 0) { printf( Child of %s is %d\n, name, getpid()); return 0; } else { printf( My child is %d\n, child_pid); return 0; { } What does this program print? Note: This example courtesy of Alex Snoeren 16

17 Shared Memory vs. Message Passing Process A Process A Process B hello world (stdout) Process B hello world shared_mem Kernel Physical Memory Kernel Physical Memory 17

18 Interprocess Communica=on Each coopera=ng must know the name of the other Shared Memory Can perform frequent and large transfers Must synchronize Message Passing No explicit need for synchroniza=on Handled by read(), write() syscalls. Kernel overhead per message Other common varia=ons of IPC Unix pipes (e.g., ls wc ) Windows Local Procedure Calls (LPCs) 18

19 Threads Separate the concept of a process from its execu=on state Process: address space, privileges, resources Execu=on state: registers, PC, SP, FP Execu=on state is called a thread of control Each thread belongs to a process Each process has at least one thread Threads are the units of scheduling (sort of) CPU runs one thread at a =me Threads execute within the context of a process 19

20 Thread in a Process Address Space 0xFFF.. (Ending Address) Stack SP1 Heap Data Segment Text Segment PC1 0x00. (Star=ng Address) 20

21 Threads in a Process Address Space SP3 Stack (Thread 3) 0xFFF.. (Ending Address) Stack (Thread 2) SP2 Thread 3 Stack (Thread 1) SP1 Thread 2 Heap Thread 1 Data Segment PC3 Text Segment PC1 PC2 0x00. (Star=ng Address) 21

22 Mul= process Web Server Using fork() for concurrency while (1) { } int sock = accept(); if ((child_pid = fork())== 0) { } Handle client request Close socket and exit else { } Close socket Before Aaer 22

23 Mul= threaded Web Server Using thread_fork() for concurrency while (1) { int sock = accept(); thread_fork(handle_req, sock); } } Before Aaer handle_req(int sock) { } Handle client request close(sock) 23

24 Scheduling Threads Process decides (user level) OS scheduler s=ll schedules per process Threads run in context of current PCB Kernel decides (kernel level) Kernel maintains thread control blocks (TCB). Kernel schedules ready threads to run. 24

25 Non Preemp=ve Scheduling Thread voluntarily gives up the CPU with thread_yield() Ping Thread while (1) { printf( ping\n ); thread_yield(); } Pong Thread while (1) { printf( pong\n ); thread_yield(); } What is the output of running these two threads? 25

26 Preemp=ve Scheduling What s the danger with non preemp=ve threads? A thread can own CPU Only voluntary calls of thread_{yield(), stop() exit()} releases the CPU Preemp=ve scheduling causes involuntary context switch Uses =mer interrupt to force thread_yield() call Nachos uses this technique 26

27 Threads Summary Parallelism useful for many applica=ons Processes are oaen too heavyweight Separa=ng parallel tasks as threads improves efficiency of mul=tasking Two primary types of threads Kernel level threads: can be efficient, but has overhead User level threads: much faster, but not supported well by OS Are there any drawbacks to threads? Difficult to program correctly No longer assume exclusive use of the resources. It s hard to get them to cooperate 27

28 When Are Resources Shared? Local variables are not shared (private) Refer to data on the stack Each thread has its own stack Should never pass/share a pointer to a local variable on the stack for thread T1 to another thread T2 Global variables and sta=c objects are shared Stored in sta=c data segment Accessible by any thread Dynamic objects (heap) are shared Allocated from heap with malloc/free or new/delete 28

29 Threading Assump=ons We assume that the only atomic ac=ons are reads and writes of words Not always the case on some architectures We assume that a context switch can occur at any =me. We assume that you can delay a thread as long as you like as long as it s not delayed forever. 29

30 Classic Example We ll represent the situa=on by crea=ng a thread for each person to do the withdrawals These threads run in the same Bank process withdraw(account, amount) { balance = get_balance(account); balance = balance - amount; put_balance(account, balance); return balance; } withdraw(account, amount) { balance = get_balance(account); balance = balance - amount; put_balance(account, balance); return balance; } What s the problem with this implementa=on? Think about the poten=al sequence of execu=ons for these threads 30

31 Interleaved Schedule The problem is that the execu=on of the two threads can be interleaved: Execu=on sequence seen by CPU balance = get_balance(account); balance = balance amount; balance = get_balance(account); balance = balance - amount; put_balance(account, balance); put_balance(account, balance); Context switch What is the balance of the account? This is known as a race condi=on: The outcome of a computa=on is dependent on the =ming or interleaving of instruc=ons. 31

32 Cri=cal Sec=on Requirements 1. Mutual exclusion If one thread is in the cri=cal sec=on, then no other is 2. Progress If some thread T is not in the cri)cal sec)on, then T cannot prevent some other thread S from entering the cri=cal sec=on 3. Bounded wai=ng (no starva=on) If some thread T is wai=ng on the cri=cal sec=on, then T will eventually enter the cri=cal sec=on 4. No assump=ons on performance Requirements must be met with any number of CPUs with arbitrary rela=ve speeds 32

33 Locks One way to implement cri=cal sec=ons is to lock the door on the way in, and unlock it again on the way out A lock is an object in memory providing two opera=ons acquire(): before entering the cri=cal sec=on release(): aaer leaving a cri=cal sec=on Threads pair calls to acquire() and release() Between acquire()/release(), the thread holds the lock acquire() does not return un=l any previous holder releases 33

34 Peterson s Algorithm Take turns only if somebody else is interested; otherwise just go struct lock { int turn = 0; int interested[2] = [FALSE,FALSE]; } void acquire(lock) { lock->interested[this_thread] = TRUE; turn = other_thread; while (lock->interested[other_thread] && turn == other_thread); } void release(lock) { lock->interested[this_thread] = FALSE; } 34

35 Using Test and Set Here is a simple lock implementa=on with test and set: struct lock { int held = 0; } void acquire(lock) { while (test-and-set(&lock->held)); } void release(lock) { lock->held = 0; } bool test_and_set(bool *flag) { bool old = *flag; *flag = True; return old; } 35

36 Problems with Spin Locks The problem with spinlocks is that they are wasteful If a thread is spinning on a lock, then the thread holding the lock cannot make progress How did the lock holder give up the CPU in the first place? Lock holder calls yield or sleep Involuntary context switch Only want to use spin locks as primi=ves to build higher level synchroniza=on constructs 36

37 Disabling Interrupts Another implementa=on of acquire/release is to disable interrupts: struct lock { int held = 0; } void acquire(lock) { disable interrupts; } void release(lock) { enable interrupts; } Note that there is no state associated with the lock 37

38 Summarize Where We Are Goal: Use mutual exclusion to protect cri=cal sec=ons of that access shared resources Method: Use locks (spin locks or disable interrupts) Problem: Cri=cal sec=ons can be long Spin locks: Threads wai=ng to acquire lock spin in test and set loop Wastes CPU cycles Longer the CS, the longer the spin Greater the chance for lock holder to be interrupted acquire(lock) Cri)cal Sec)on release(lock) Disabling Interrupts: Should not disable interrupts for long periods of =me Can miss or delay important events (e.g., =mer, I/O) 38

39 Higher Level Synchroniza=on Need higher level synchroniza=on primi=ves that: Block waiters Leave interrupts enabled within the cri=cal sec=on All synchroniza=on requires atomicity So we ll use our atomic locks as primi=ves to implement them 39

40 Semaphores Semaphores are another data structure that provides mutual exclusion to cri=cal sec=ons Block waiters, interrupts enabled within cri=cal sec=on Semaphores support two opera=ons: wait(semaphore): block un=l semaphore is open, decrement Blocking threads are put on a wait queue. signal(semaphore): increment, allow another thread to enter If no threads are wai=ng on the queue, the signal is remembered for the next thread In other words, signal() has history Semaphores can also be used as atomic counters 40

41 Semaphore Types Semaphores come in two types Determined by semaphore value (aka count ) Mutex semaphore (count = 1) Represents single access to a resource Guarantees mutual exclusion to a cri=cal sec=on Coun=ng semaphore (count = N) Represents a resource with many units available, or a resource that allows certain kinds of unsynchronized concurrent access (e.g., reading) N threads can pass the semaphore 41

42 Semaphore Summary Semaphore drawbacks They are essen=ally shared global variables Can poten=ally be accessed anywhere in program No connec=on between the semaphore and the data being controlled by the semaphore Used both for cri=cal sec=ons (mutual exclusion) and coordina=on (scheduling) Note that I had to use comments in the code to dis=nguish No control or guarantee of proper usage Some=mes hard to use and prone to bugs Another approach: Use programming language support 42

43 Monitors A monitor is a programming language construct that controls access to shared data Synchroniza=on code added by compiler, enforced at run=me Why is this an advantage? A monitor is a module that encapsulates Shared data structures Procedures that operate on the shared data structures Synchroniza=on between concurrent threads that invoke the procedures A monitor protects its data from unstructured access It guarantees that threads accessing its data through its procedures interact only in legi=mate ways 43

44 Monitor Seman=cs A monitor guarantees mutual exclusion Only one thread can execute any monitor procedure at any =me (the thread is in the monitor ) If a second thread invokes a monitor procedure when a first thread is already execu=ng one, it blocks So the monitor has to have a wait queue If a thread within a monitor blocks, another one can enter 44

45 Condi=on Variables Condi=on variables provide a mechanism to wait for events (a rendezvous point ) Condi=on variables support three opera=ons: Wait: release monitor lock, wait for C/V to be signaled So CVs have wait queues too Signal: wakeup one wai=ng thread Broadcast: wakeup all wai=ng threads 45

46 Hoare vs Mesa Monitors Hoare (immediately switch to wai=ng thread) if (empty) wait(condition) Mesa (put wai=ng thread on ready queue) while(empty) wait(condition) Tradeoffs Mesa monitors easier to use, more efficient Fewer context switches, easy to support broadcast Hoare monitors leave less to chance Easier to reason about the program 46

47 Condi=on Variables and Locks Condi=on variables are also used without monitors in conjunc=on with blocking locks A monitor is just like a module whose state includes a condi=on variable and a lock Difference is syntac=c; with monitors, compiler adds the code It is just as if each procedure in the module calls acquire() on entry and release() on exit But can be done anywhere in procedure, at finer granularity With condi=on variables, the module methods may wait and signal on independent condi=ons 47

48 Using Condi=on Variables and Locks Alterna=on of two threads (ping pong) Each executes the following: Lock lock; Condition cond; void ping() { acquire(lock); while(1) { printf( ping\n ); signal(cond, lock); wait(cond, lock); } release(lock); } Must acquire lock before you can wait (similar to needing interrupts disabled to call sleep in Nachos) Wait atomically releases lock and blocks un=l signal() Wait atomically acquires lock before it returns 48

49 Synchroniza=on Summary Semaphores wait()/signal() implement blocking mutual exclusion Also used as atomic counters (coun=ng semaphores) Can be inconvenient to use Monitors Synchronizes execu=on within procedures that manipulate encapsulated data shared among procedures Only one thread can execute within a monitor at a =me Relies upon high level language support Condi=on variables Used by threads as a synchroniza=on point to wait for events Inside monitors, or outside with locks 49

50 Scheduling Horizons Scheduling works at two levels in an opera=ng system Long term scheduling happens rela=vely infrequently Significant overhead in swapping a process out to disk Short term scheduling happens rela=vely frequently Want to minimize the overhead of scheduling 50

51 Scheduling Goals Scheduling algorithms can have many different goals: CPU u=liza=on I/O u=liza=on Job throughput (# jobs/unit =me) Turnaround =me (T finish T arrival ) Wai=ng =me (Avg(T wait ): avg =me spent on wait queues) Response =me (Avg(T ready ): avg =me spent on ready queue) Batch systems Strive for job throughput, turnaround =me (supercomputers) Interac=ve systems Strive to minimize response =me for interac=ve jobs (PC) 51

52 Starva=on Starva=on occurs when a job cannot make progress because some other job has the resource it requires We ve seen locks, Monitors, Semaphores, etc. The same thing can happen with the CPU! 52

53 Scheduling Algorithms First come first served (FCFS), first in first out (FIFO) Jobs are scheduled in order of arrival to ready queue Shortest Job First (SJF) Choose the job with the smallest expected CPU burst Person with smallest number of items to buy Provably op=mal minimum average wai=ng =me Round Robin Ready queue is treated as a circular queue (FIFO) Each job is given a =me slice called a quantum Priority Scheduling Choose next job based on highest priority 53

54 Combining Algorithms Scheduling algorithms can be combined Have mul=ple queues Use a different algorithm for each queue Move processes among queues Mul=ple Level Feedback Queues (MLFQ) Mul=ple queues represen=ng different job types Interac=ve, CPU bound, batch, system, etc. Queues have priori=es, jobs on same queue scheduled RR Jobs can move among queues based upon execu=on history Feedback: Switch from interac=ve to CPU bound behavior 54

55 Priority Inversion Problem descrip=on A high priority thread is stuck wai=ng for a low priority thread to finish In this case, the medium priority thread was holding up the lowpriority thread Solu=on: Priority Inheritance Allow a thread to inherit the priority of any thread that is wai=ng for it Blocked, higher priority threads donate their priority to lower priority threads Dona=on only occurs as long as the higher priority thread is blocked once this is no longer true, threads retain their original priority 55

56 Deadlock Defini=on Defini=on: Deadlock exists among a set of processes if every process is wai=ng for an event that can be caused only by another process in the set. 56

57 Condi=ons for Deadlock Deadlock can exist if and only if four condi=ons hold: Mutual exclusion At least one resource must be held in a non sharable mode (i.e., only one instance) Hold and wait There must be one process holding one resource and wai=ng for another resource No preemp=on resources cannot be preempted (i.e., cri=cal sec=ons cannot be aborted externally) Circular wait There must exist a set of processes {P 1, P 2, P 3,,P n } such that P 1 is wai=ng for a resource held by P 2, P 2 is wai=ng for P 3,, and P n for P 1 57

58 Dealing with Deadlock There are four ways to deal with deadlock: Ignore it Do you feel lucky? Preven=on Make one of the four condi=ons impossible Avoidance Control alloca=on of resources (Banker s Algorithm) Detec=on and recovery Look for a cycle in dependencies Preempt or abort 58

59 Starva=on: Starva=on and Deadlock A thread never makes progress because other threads are using a resource it needs Deadlock: A circular resource dependency between mul=ple threads such that none of them can make progress. Starva=on is not the same as deadlock 59

Lecture 2: Processes. CSE 120: Principles of Opera9ng Systems. UC San Diego: Summer Session I, 2009 Frank Uyeda

Lecture 2: Processes. CSE 120: Principles of Opera9ng Systems. UC San Diego: Summer Session I, 2009 Frank Uyeda Lecture 2: Processes CSE 120: Principles of Opera9ng Systems UC San Diego: Summer Session I, 2009 Frank Uyeda Announcements PeerWise accounts are now live. First PeerWise ques9ons/reviews due tomorrow

More information

Lecture 5: Synchronization w/locks

Lecture 5: Synchronization w/locks Lecture 5: Synchronization w/locks CSE 120: Principles of Operating Systems Alex C. Snoeren Lab 1 Due 10/19 Threads Are Made to Share Global variables and static objects are shared Stored in the static

More information

Lecture 7: CVs & Scheduling

Lecture 7: CVs & Scheduling Lecture 7: CVs & Scheduling CSE 120: Principles of Operating Systems Alex C. Snoeren HW 2 Due 10/17 Monitors A monitor is a programming language construct that controls access to shared data Synchronization

More information

Opera&ng Systems ECE344

Opera&ng Systems ECE344 Opera&ng Systems ECE344 Lecture 10: Scheduling Ding Yuan Scheduling Overview In discussing process management and synchroniza&on, we talked about context switching among processes/threads on the ready

More information

Lecture 9: Midterm Review

Lecture 9: Midterm Review Project 1 Due at Midnight Lecture 9: Midterm Review CSE 120: Principles of Operating Systems Alex C. Snoeren Midterm Everything we ve covered is fair game Readings, lectures, homework, and Nachos Yes,

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 7: Synchronization Administrivia Homework 1 Due today by the end of day Hopefully you have started on project 1 by now? Kernel-level threads (preemptable

More information

Lecture 6 (cont.): Semaphores and Monitors

Lecture 6 (cont.): Semaphores and Monitors Project 1 Due Thursday 10/20 Lecture 6 (cont.): Semaphores and Monitors CSE 120: Principles of Operating Systems Alex C. Snoeren Higher-Level Synchronization We looked at using locks to provide mutual

More information

Opera&ng Systems ECE344

Opera&ng Systems ECE344 Opera&ng Systems ECE344 Lecture 6: Synchroniza&on (II) Semaphores and Monitors Ding Yuan Higher- Level Synchroniza&on We looked at using locks to provide mutual exclusion Locks work, but they have some

More information

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo CSE 120 Principles of Operating Systems Fall 2007 Lecture 8: Scheduling and Deadlock Keith Marzullo Aministrivia Homework 2 due now Next lecture: midterm review Next Tuesday: midterm 2 Scheduling Overview

More information

Dealing with Issues for Interprocess Communication

Dealing with Issues for Interprocess Communication Dealing with Issues for Interprocess Communication Ref Section 2.3 Tanenbaum 7.1 Overview Processes frequently need to communicate with other processes. In a shell pipe the o/p of one process is passed

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 2018 Midterm Review Midterm in class on Monday Covers material through scheduling and deadlock Based upon lecture material and modules of the book indicated on

More information

CS370 Opera;ng Systems Midterm Review. Yashwant K Malaiya Spring 2018

CS370 Opera;ng Systems Midterm Review. Yashwant K Malaiya Spring 2018 CS370 Opera;ng Systems Midterm Review Yashwant K Malaiya Spring 2018 1 1 Computer System Structures Computer System Opera2on Stack for calling func2ons (subrou2nes) I/O Structure: polling, interrupts,

More information

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Hank Levy 412 Sieg Hall

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Hank Levy 412 Sieg Hall CSE 451: Operating Systems Winter 2003 Lecture 7 Synchronization Hank Levy Levy@cs.washington.edu 412 Sieg Hall Synchronization Threads cooperate in multithreaded programs to share resources, access shared

More information

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Steve Gribble. Synchronization. Threads cooperate in multithreaded programs

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Steve Gribble. Synchronization. Threads cooperate in multithreaded programs CSE 451: Operating Systems Winter 2005 Lecture 7 Synchronization Steve Gribble Synchronization Threads cooperate in multithreaded programs to share resources, access shared data structures e.g., threads

More information

CSE 153 Design of Operating Systems Fall 2018

CSE 153 Design of Operating Systems Fall 2018 CSE 153 Design of Operating Systems Fall 2018 Lecture 5: Threads/Synchronization Implementing threads l Kernel Level Threads l u u All thread operations are implemented in the kernel The OS schedules all

More information

Operating Systems. Synchronization

Operating Systems. Synchronization Operating Systems Fall 2014 Synchronization Myungjin Lee myungjin.lee@ed.ac.uk 1 Temporal relations Instructions executed by a single thread are totally ordered A < B < C < Absent synchronization, instructions

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Fall 2016 Lecture 8: Scheduling and Deadlock Geoffrey M. Voelker Administrivia Thursday Friday Monday Homework #2 due at start of class Review material for midterm

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 19 Lecture 7/8: Synchronization (1) Administrivia How is Lab going? Be prepared with questions for this weeks Lab My impression from TAs is that you are on track

More information

CSE Opera,ng System Principles

CSE Opera,ng System Principles CSE 30341 Opera,ng System Principles Synchroniza2on Overview Background The Cri,cal-Sec,on Problem Peterson s Solu,on Synchroniza,on Hardware Mutex Locks Semaphores Classic Problems of Synchroniza,on Monitors

More information

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008. CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon

More information

CS 318 Principles of Operating Systems

CS 318 Principles of Operating Systems CS 318 Principles of Operating Systems Fall 2017 Midterm Review Ryan Huang 10/12/17 CS 318 Midterm Review 2 Midterm October 17 th Tuesday 9:00-10:20 am at classroom Covers material before virtual memory

More information

CSE 120 Principles of Operating Systems Spring 2017

CSE 120 Principles of Operating Systems Spring 2017 CSE 120 Principles of Operating Systems Spring 2017 Lecture 5: Scheduling Administrivia Homework #1 due tomorrow Homework #2 out tomorrow October 20, 2015 CSE 120 Lecture 8 Scheduling and Deadlock 2 Scheduling

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 2018 Lecture 10: Monitors Monitors A monitor is a programming language construct that controls access to shared data Synchronization code added by compiler, enforced

More information

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Processes Prof. James L. Frankel Harvard University Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Process Model Each process consists of a sequential program

More information

Networks and Opera/ng Systems Chapter 13: Scheduling

Networks and Opera/ng Systems Chapter 13: Scheduling Networks and Opera/ng Systems Chapter 13: Scheduling (252 0062 00) Donald Kossmann & Torsten Hoefler Frühjahrssemester 2013 Systems Group Department of Computer Science ETH Zürich Last /me Process concepts

More information

Synchroniza+on. Today: Implementa+on issues

Synchroniza+on. Today: Implementa+on issues Synchroniza+on Today: Implementa+on issues Readers/Writers Lock A common variant for mutual exclusion One writer at a +me, if no readers Many readers, if no writer How might we implement this? ReaderAcquire(),

More information

CS370 Operating Systems Midterm Review

CS370 Operating Systems Midterm Review CS370 Operating Systems Midterm Review Yashwant K Malaiya Fall 2015 Slides based on Text by Silberschatz, Galvin, Gagne 1 1 What is an Operating System? An OS is a program that acts an intermediary between

More information

CS-537: Midterm Exam (Spring 2001)

CS-537: Midterm Exam (Spring 2001) CS-537: Midterm Exam (Spring 2001) Please Read All Questions Carefully! There are seven (7) total numbered pages Name: 1 Grading Page Points Total Possible Part I: Short Answers (12 5) 60 Part II: Long

More information

Operating Systems ECE344

Operating Systems ECE344 Operating Systems ECE344 Ding Yuan Announcement & Reminder Lab 0 mark posted on Piazza Great job! One problem: compilation error I fixed some for you this time, but won t do it next time Make sure you

More information

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions).

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions). OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions). (a) (b) (c) (d) (e) (f) (g) (h) (i) T_ The two primary purposes of an operating

More information

CS370 OperaBng Systems

CS370 OperaBng Systems CS370 OperaBng Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 14 Deadlock Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ What happens if only one program

More information

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems Processes CS 475, Spring 2018 Concurrent & Distributed Systems Review: Abstractions 2 Review: Concurrency & Parallelism 4 different things: T1 T2 T3 T4 Concurrency: (1 processor) Time T1 T2 T3 T4 T1 T1

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006 Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select

More information

Synchronization. CS61, Lecture 18. Prof. Stephen Chong November 3, 2011

Synchronization. CS61, Lecture 18. Prof. Stephen Chong November 3, 2011 Synchronization CS61, Lecture 18 Prof. Stephen Chong November 3, 2011 Announcements Assignment 5 Tell us your group by Sunday Nov 6 Due Thursday Nov 17 Talks of interest in next two days Towards Predictable,

More information

Lecture 4: Threads; weaving control flow

Lecture 4: Threads; weaving control flow Lecture 4: Threads; weaving control flow CSE 120: Principles of Operating Systems Alex C. Snoeren HW 1 Due NOW Announcements Homework #1 due now Project 0 due tonight Project groups Please send project

More information

CS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019

CS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019 CS 31: Introduction to Computer Systems 22-23: Threads & Synchronization April 16-18, 2019 Making Programs Run Faster We all like how fast computers are In the old days (1980 s - 2005): Algorithm too slow?

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 9: Semaphores and Monitors Some slides from Matt Welsh Summarize Where We Are Goal: Use mutual exclusion to protect critical sections of code that

More information

Reminder from last <me

Reminder from last <me Concurrent systems Lecture 2: Mutual exclusion and process synchronisa

More information

Advanced Operating Systems (CS 202) Scheduling (1)

Advanced Operating Systems (CS 202) Scheduling (1) Advanced Operating Systems (CS 202) Scheduling (1) Today: CPU Scheduling 2 The Process The process is the OS abstraction for execution It is the unit of execution It is the unit of scheduling It is the

More information

The Kernel Abstrac/on

The Kernel Abstrac/on The Kernel Abstrac/on Debugging as Engineering Much of your /me in this course will be spent debugging In industry, 50% of sobware dev is debugging Even more for kernel development How do you reduce /me

More information

CSE 120 Principles of Operating Systems Spring 2016

CSE 120 Principles of Operating Systems Spring 2016 CSE 120 Principles of Operating Systems Spring 2016 Condition Variables and Monitors Monitors A monitor is a programming language construct that controls access to shared data Synchronization code added

More information

10/17/ Gribble, Lazowska, Levy, Zahorjan 2. 10/17/ Gribble, Lazowska, Levy, Zahorjan 4

10/17/ Gribble, Lazowska, Levy, Zahorjan 2. 10/17/ Gribble, Lazowska, Levy, Zahorjan 4 Temporal relations CSE 451: Operating Systems Autumn 2010 Module 7 Synchronization Instructions executed by a single thread are totally ordered A < B < C < Absent synchronization, instructions executed

More information

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo PROCESS MANAGEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication

More information

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 The Process Concept 2 The Process Concept Process a program in execution

More information

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):

More information

CHAPTER 2: PROCESS MANAGEMENT

CHAPTER 2: PROCESS MANAGEMENT 1 CHAPTER 2: PROCESS MANAGEMENT Slides by: Ms. Shree Jaswal TOPICS TO BE COVERED Process description: Process, Process States, Process Control Block (PCB), Threads, Thread management. Process Scheduling:

More information

Synchroniza+on II COMS W4118

Synchroniza+on II COMS W4118 Synchroniza+on II COMS W4118 References: Opera+ng Systems Concepts (9e), Linux Kernel Development, previous W4118s Copyright no2ce: care has been taken to use only those web images deemed by the instructor

More information

MARUTHI SCHOOL OF BANKING (MSB)

MARUTHI SCHOOL OF BANKING (MSB) MARUTHI SCHOOL OF BANKING (MSB) SO IT - OPERATING SYSTEM(2017) 1. is mainly responsible for allocating the resources as per process requirement? 1.RAM 2.Compiler 3.Operating Systems 4.Software 2.Which

More information

CS 318 Principles of Operating Systems

CS 318 Principles of Operating Systems CS 318 Principles of Operating Systems Fall 2017 Lecture 7: Semaphores and Monitors Ryan Huang Higher-Level Synchronization We looked at using locks to provide mutual exclusion Locks work, but they have

More information

Synchronization. Dr. Yingwu Zhu

Synchronization. Dr. Yingwu Zhu Synchronization Dr. Yingwu Zhu Synchronization Threads cooperate in multithreaded programs To share resources, access shared data structures Threads accessing a memory cache in a Web server To coordinate

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 12: Scheduling & Deadlock Priority Scheduling Priority Scheduling Choose next job based on priority» Airline checkin for first class passengers Can

More information

CS533 Concepts of Operating Systems. Jonathan Walpole

CS533 Concepts of Operating Systems. Jonathan Walpole CS533 Concepts of Operating Systems Jonathan Walpole Introduction to Threads and Concurrency Why is Concurrency Important? Why study threads and concurrent programming in an OS class? What is a thread?

More information

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 Process creation in UNIX All processes have a unique process id getpid(),

More information

Introduction to Threads

Introduction to Threads Computer Systems Introduction to Threads Race Conditions Single- vs. Multi-Threaded Processes Process Process Thread Thread Thread Thread Memory Memory Heap Stack Heap Stack Stack Stack Data Data Code

More information

CSE 120. Fall Lecture 6: Semaphores. Keith Marzullo

CSE 120. Fall Lecture 6: Semaphores. Keith Marzullo CSE 120 Principles of Operating Systems Fall 2007 Lecture 6: Semaphores Keith Marzullo Announcements Homework #2 out Homework #1 almost graded... Discussion session on Wednesday will entertain questions

More information

CSE 451: Operating Systems Winter Synchronization. Gary Kimura

CSE 451: Operating Systems Winter Synchronization. Gary Kimura CSE 451: Operating Systems Winter 2013 Synchronization Gary Kimura Synchronization Threads cooperate in multithreaded programs to share resources, access shared data structures e.g., threads accessing

More information

CSCI [4 6] 730 Operating Systems. Example Execution. Process [& Thread] Synchronization. Why does cooperation require synchronization?

CSCI [4 6] 730 Operating Systems. Example Execution. Process [& Thread] Synchronization. Why does cooperation require synchronization? Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics Why is synchronization needed? Synchronization Language/Definitions: What are race conditions? What

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 6: Threads Recap: Process Components Per- Process State Per- Thread State A process is named using its process ID (PID) A process contains all of

More information

CSE 120 Principles of Operating Systems Spring 2016

CSE 120 Principles of Operating Systems Spring 2016 CSE 120 Principles of Operating Systems Spring 2016 Semaphores and Monitors Higher-Level Synchronization We looked at using locks to provide mutual exclusion Locks work, but they have limited semantics

More information

UNIT:2. Process Management

UNIT:2. Process Management 1 UNIT:2 Process Management SYLLABUS 2.1 Process and Process management i. Process model overview ii. Programmers view of process iii. Process states 2.2 Process and Processor Scheduling i Scheduling Criteria

More information

Operating Systems (1DT020 & 1TT802)

Operating Systems (1DT020 & 1TT802) Uppsala University Department of Information Technology Name: Perso. no: Operating Systems (1DT020 & 1TT802) 2009-05-27 This is a closed book exam. Calculators are not allowed. Answers should be written

More information

CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio

CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio Fall 2017 1 Outline Inter-Process Communication (20) Threads

More information

Synchronization I. Jo, Heeseung

Synchronization I. Jo, Heeseung Synchronization I Jo, Heeseung Today's Topics Synchronization problem Locks 2 Synchronization Threads cooperate in multithreaded programs To share resources, access shared data structures Also, to coordinate

More information

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic) Sample Questions Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Sample Questions 1393/8/10 1 / 29 Question 1 Suppose a thread

More information

CS370 Operating Systems Midterm Review. Yashwant K Malaiya Spring 2019

CS370 Operating Systems Midterm Review. Yashwant K Malaiya Spring 2019 CS370 Operating Systems Midterm Review Yashwant K Malaiya Spring 2019 1 1 Computer System Structures Computer System Operation Stack for calling functions (subroutines) I/O Structure: polling, interrupts,

More information

CSE 153 Design of Operating Systems Fall 2018

CSE 153 Design of Operating Systems Fall 2018 CSE 153 Design of Operating Systems Fall 2018 Lecture 4: Processes (2) Threads Process Creation: Unix In Unix, processes are created using fork() int fork() fork() Creates and initializes a new PCB Creates

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 11 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Multilevel Feedback Queue: Q0, Q1,

More information

Operating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017

Operating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Operating Systems Lecture 4 - Concurrency and Synchronization Adrien Krähenbühl Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Mutual exclusion Hardware solutions Semaphores IPC: Message passing

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Spring 2009 Lecture 4: Threads Geoffrey M. Voelker Announcements Homework #1 due now Project 0 due tonight Project 1 out April 9, 2009 CSE 120 Lecture 4 Threads

More information

Course Syllabus. Operating Systems

Course Syllabus. Operating Systems Course Syllabus. Introduction - History; Views; Concepts; Structure 2. Process Management - Processes; State + Resources; Threads; Unix implementation of Processes 3. Scheduling Paradigms; Unix; Modeling

More information

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections ) CPU Scheduling CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections 6.7.2 6.8) 1 Contents Why Scheduling? Basic Concepts of Scheduling Scheduling Criteria A Basic Scheduling

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Fall 2000 Lecture 5: Threads Geoffrey M. Voelker Processes Recall that a process includes many things An address space (defining all the code and data pages) OS

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013 Operating Systems Comprehensive Exam Spring 2013 Student ID # 3/20/2013 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering)

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering) A. Multiple Choice Questions (60 questions) Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering) Unit-I 1. What is operating system? a) collection of programs that manages hardware

More information

Operating Systems. Operating Systems Summer 2017 Sina Meraji U of T

Operating Systems. Operating Systems Summer 2017 Sina Meraji U of T Operating Systems Operating Systems Summer 2017 Sina Meraji U of T More Special Instructions Swap (or Exchange) instruction Operates on two words atomically Can also be used to solve critical section problem

More information

Operating Systems: Quiz2 December 15, Class: No. Name:

Operating Systems: Quiz2 December 15, Class: No. Name: Operating Systems: Quiz2 December 15, 2006 Class: No. Name: Part I (30%) Multiple Choice Each of the following questions has only one correct answer. Fill the correct one in the blank in front of each

More information

Lecture 2 Process Management

Lecture 2 Process Management Lecture 2 Process Management Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks The terms job and process may be interchangeable

More information

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski Operating Systems Design Fall 2010 Exam 1 Review Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 To a programmer, a system call looks just like a function call. Explain the difference in the underlying

More information

Operating Systems. Sina Meraji U of T

Operating Systems. Sina Meraji U of T Operating Systems Sina Meraji U of T 1 Announcement Check discussion board for announcements A1 is posted 2 Recap: Process Creation: Unix In Unix, processes are created using fork() int fork() fork() Creates

More information

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions: Techno India Batanagar Department of Computer Science & Engineering Model Questions Subject Name: Operating System Multiple Choice Questions: Subject Code: CS603 1) Shell is the exclusive feature of a)

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Fall 2015 Lecture 4: Threads Geoffrey M. Voelker Announcements Project 0 due Project 1 out October 6, 2015 CSE 120 Lecture 4 Threads 2 Processes Recall that a process

More information

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling Review Preview Mutual Exclusion Solutions with Busy Waiting Test and Set Lock Priority Inversion problem with busy waiting Mutual Exclusion with Sleep and Wakeup The Producer-Consumer Problem Race Condition

More information

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules Brief Preview of Scheduling Concurrency Control Nan Niu (nn@cs.toronto.edu) CSC309 -- Summer 2008 Multiple threads ready to run Some mechanism for switching between them Context switches Some policy for

More information

CSE 120 Principles of Operating Systems Spring 2016

CSE 120 Principles of Operating Systems Spring 2016 CSE 120 Principles of Operating Systems Spring 2016 Using Semaphores and Condition Variables Higher-Level Synchronization We looked at using locks to provide mutual exclusion Locks work, but they have

More information

CS3733: Operating Systems

CS3733: Operating Systems CS3733: Operating Systems Topics: Process (CPU) Scheduling (SGG 5.1-5.3, 6.7 and web notes) Instructor: Dr. Dakai Zhu 1 Updates and Q&A Homework-02: late submission allowed until Friday!! Submit on Blackboard

More information

OS Structure. User mode/ kernel mode. System call. Other concepts to know. Memory protection, privileged instructions

OS Structure. User mode/ kernel mode. System call. Other concepts to know. Memory protection, privileged instructions Midterm Review OS Structure User mode/ kernel mode Memory protection, privileged instructions System call Definition, examples, how it works? Other concepts to know Monolithic kernel vs. Micro kernel 2

More information

Introduction to OS Synchronization MOS 2.3

Introduction to OS Synchronization MOS 2.3 Introduction to OS Synchronization MOS 2.3 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Challenge How can we help processes synchronize with each other? E.g., how

More information

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling CSE120 Principles of Operating Systems Prof Yuanyuan (YY) Zhou Scheduling Announcement l Homework 2 due on October 26th l Project 1 due on October 27th 2 Scheduling Overview l In discussing process management

More information

Operating Systems ECE344. Ding Yuan

Operating Systems ECE344. Ding Yuan Operating Systems ECE344 Ding Yuan Announcement & Reminder Midterm exam Will grade them this Friday Will post the solution online before next lecture Will briefly go over the common mistakes next Monday

More information

CS 322 Operating Systems Practice Midterm Questions

CS 322 Operating Systems Practice Midterm Questions ! CS 322 Operating Systems 1. Processes go through the following states in their lifetime. time slice ends Consider the following events and answer the questions that follow. Assume there are 5 processes,

More information

OS Structure. User mode/ kernel mode (Dual-Mode) Memory protection, privileged instructions. Definition, examples, how it works?

OS Structure. User mode/ kernel mode (Dual-Mode) Memory protection, privileged instructions. Definition, examples, how it works? Midterm Review OS Structure User mode/ kernel mode (Dual-Mode) Memory protection, privileged instructions System call Definition, examples, how it works? Other concepts to know Monolithic kernel vs. Micro

More information

Processes-Process Concept:

Processes-Process Concept: UNIT-II PROCESS MANAGEMENT Processes-Process Concept: An operating system executes a variety of programs: O Batch system jobs o Time-shared systems user programs or tasks We will use the terms job and

More information

Midterm Exam Amy Murphy 6 March 2002

Midterm Exam Amy Murphy 6 March 2002 University of Rochester Midterm Exam Amy Murphy 6 March 2002 Computer Systems (CSC2/456) Read before beginning: Please write clearly. Illegible answers cannot be graded. Be sure to identify all of your

More information

Synchronization I. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Synchronization I. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Synchronization I Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics Synchronization problem Locks 2 Synchronization Threads cooperate

More information

Processes, Context Switching, and Scheduling. Kevin Webb Swarthmore College January 30, 2018

Processes, Context Switching, and Scheduling. Kevin Webb Swarthmore College January 30, 2018 Processes, Context Switching, and Scheduling Kevin Webb Swarthmore College January 30, 2018 Today s Goals What is a process to the OS? What are a process s resources and how does it get them? In particular:

More information

Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year

Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year Dr. Rafiq Zakaria Campus Maulana Azad College of Arts, Science & Commerce, Aurangabad Department of Computer Science Academic Year 2015-16 MCQs on Operating System Sem.-II 1.What is operating system? a)

More information

8: Scheduling. Scheduling. Mark Handley

8: Scheduling. Scheduling. Mark Handley 8: Scheduling Mark Handley Scheduling On a multiprocessing system, more than one process may be available to run. The task of deciding which process to run next is called scheduling, and is performed by

More information

* What are the different states for a task in an OS?

* What are the different states for a task in an OS? * Kernel, Services, Libraries, Application: define the 4 terms, and their roles. The kernel is a computer program that manages input/output requests from software, and translates them into data processing

More information

Chapter 2 Processes and Threads. Interprocess Communication Race Conditions

Chapter 2 Processes and Threads. Interprocess Communication Race Conditions Chapter 2 Processes and Threads [ ] 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling 85 Interprocess Communication Race Conditions Two processes want to access shared memory at

More information

Threads and Synchronization. Kevin Webb Swarthmore College February 15, 2018

Threads and Synchronization. Kevin Webb Swarthmore College February 15, 2018 Threads and Synchronization Kevin Webb Swarthmore College February 15, 2018 Today s Goals Extend processes to allow for multiple execution contexts (threads) Benefits and challenges of concurrency Race

More information