examquestions - 1. Draw a diagram of possible state...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
New Ready-TO-Run Running Blocked Terminated 1. Draw a diagram of possible state transitions for a process (possible states are RUNNING, READY- TO-RUN, BLOCKED, and TERMINATED). 2 . What are the steps an operating system has to perform during the context switch between two processes (if it uses paging for memory management)? - Need to save user space context (registers for current process). - Change PCB position in PCB Queue. - Restore new process state and bring segments in memory if required. Need to save the processor registers, stack pointer, program counter into the TCB of the thread that is no longer running. Need to reload the same things from the TCB of the new thread. 3 . Is context-switching between two threads less expensive than switching between two processes? Why? Context switching between two threads is less expensive. Because thread context switching doen’t involved mode changes and thread context switching is managed in user space only not address space. Thread context switching doesn’t need to save any OS specific data. 4. A brand new SGI Altix Intel Itanium system has 64 CPUs running Linux OS. What is the maximum number of processes in RUNNING state at a single time when it executes 200 processes? What is the maximum number of processes in BLOCKED state? 5. Why is busy waiting a bad idea when running an application with multiple processes on just 1 processor? Busy waiting wastes CPU cycles that some other prcess might be able to use productively. 6. All processes arrive in numerical order at time 0 with the following running times: P1 300ms, P2 50ms, P3 200ms. If the time-slice quantum is 50ms, show the scheduling order for these processes under FIFO (First-In-First-Out), SJF (Shortest-Job-First), and RR (Round-Robin) CPU scheduling algorithm. Draw Gantt chart for the 3 algorithms. FIFO: P1(0) P2(300) P3(350) SJF: P2(0) P3(50) P1(250) RR:P1(0) P2(50) P3(100) P1(150) P3(200) P1(250) P3(300) P1(350) P3(400) P1(450) 7. Consider the following two threads, to be run concurrently in a shared memory (all variables are shared between the two threads). Thread A Thread B for i = 1 to 5 do x = x + 1; for j = 1 to 5 do x = x + 1; Assuming a single processor system, that load and store are atomic, that x is initialized to 0, and that x must be loaded into a register before being incremented (and stored back to memory afterwards), what are all the possible values for x after both threads have completed?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8. Why is it dangerous to acquire a lock in an interrupt handler? 9. Assume that Lock is implemented using a test-and-set instruction and busy (spin) waiting. Also assume
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/25/2009 for the course COP cop4610 taught by Professor Ruji during the Spring '09 term at FIU.

Page1 / 6

examquestions - 1. Draw a diagram of possible state...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online