DOC PREVIEW
U of I CS 241 - Homework 2 – System Programming

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Shadow Homework 2 – System Programming (Processes, Threads, Synchronization and Scheduling) Posted February 15, 2007 (NOT GRADED) Shadow Homework 2 on Processes, Threads, Synchronization and Scheduling 1. Draw a state transition diagram with three process states “Ready” “Running” and “Blocked”. Indicate allowed transitions between these states . 2. Give at least two differences and two similarities between an application that is implemented using multiple processes and one that is implemented using multiple threads. Your answer should emphasize the performance and resource issues in each case. 3. List and explain four resources that must be saved and restored during a process context-switch. 4. Explain what is the problem with this implementation of the one-writer many-readers problem? (Note, “Up” is equivalent to “sem_post” & “Down” is equivalent to “sem_wait”) int readcount; // shared and initialized to 0 Semaphore mutex, wrt; // shared and initialized to 1; // Writer : // Readers : Down(mutex); readcount := readcount + 1; Down(wrt); if readcount == 1 then Down(wrt); /* Writing performed*/ Up(mutex); Up(wrt); /*reading performed*/ Down(mutex); readcount := readcount - 1; if readcount == 0 then Up(wrt); Up(mutex); 5. Consider the following table about processes: Process Priority* Burst Time Arrival Time P14 100ms 0ms P22 20ms 30ms P31 50ms 40ms P43 5ms 60ms * A smaller priority number means a higher priority process The schedule for First Come First Served is shown below FCFS: P1 P2 P3 P4 |--------|--------|--------|--------|0 100 120 170 175 a) Explain the term Average Waiting Time. c) What is the most important characteristic of Shortest Job First scheduling? d) Edit the following skeleton schedules for the process table to show the scheduling disciplines: i) Preemptive Shortest Job First |--------|--------|--------|--------| ii) Preemptive Priority |--------|--------|--------|--------| iii) Round Robin (with quantum 40ms)


View Full Document

U of I CS 241 - Homework 2 – System Programming

Documents in this Course
Process

Process

28 pages

Files

Files

37 pages

File I/O

File I/O

52 pages

C Basics

C Basics

69 pages

Memory

Memory

23 pages

Threads

Threads

14 pages

Lecture

Lecture

55 pages

C Basics

C Basics

24 pages

Signals

Signals

27 pages

Memory

Memory

45 pages

Threads

Threads

47 pages

Threads

Threads

28 pages

LECTURE

LECTURE

45 pages

Threads

Threads

30 pages

Threads

Threads

55 pages

Files

Files

37 pages

SIGNALS

SIGNALS

22 pages

Files

Files

37 pages

Threads

Threads

14 pages

Threads

Threads

13 pages

Load more
Download Homework 2 – System Programming
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework 2 – System Programming and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework 2 – System Programming 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?