Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
EASTERN MEDITERRANEAN UNIVERSITY COMPUTER ENGINEERING DEPARTMENT CMPE-242 Operating Systems SPRING 2013-2014 MID I 16/04/2014 100 minutes, attempt all... Student No :…SOLUTION……………...........… Name Surname :………………….......... Group: :…………………………… (Instructors: [Gr. 1] Dr. Ahmet Ünveren, [Gr.2] Dr. Alexander Chefranov) Grades Collected Q1 Q2 Q3 Q4 Q5 Q6 Q7 TOTAL CMPE242 Operating Systems Q.1.(20 pts.) a) (2.5 points) What are the two main goals of an operating system? - interfacing with a user, - resource management b) (2.5 points) What services are provided by the kernel of an operating system? Specify any three - Process management Processor scheduling Processes communication c) (2.5 points) What are the benefits of multiprogramming? Specify any two - Increase CPU utilization - Decrease response time d) - (2.5 points) What are the types of parallel systems? Specify any three Centralized Decentralized symmetric e) (2.5 points) What an interrupt is? What an interrupt vector is? - Interrupt is a signal (usually, externally generated) causing switching CPU to the respective interruption service routine (ISR) Interrupt vector contains ISR address f) (2.5 points) How information is organized in magnetic disks? Explain notions of surface, track, sector, cylinder Information is kept on several magnetic material covered surfaces and on each surface is organized in concentric circles (tracks) split into sectors, usually of 512 bytes. Same radius tracks of different surfaces form a cylinder accessible by magnetic headers without moving g) (2.5 points) What two registers are used for memory protection in multiprogramming environment? What do they hold? - Base register – contains minimal address of the memory allocated to a process - Limit register – contains the size of the allocated memory h) (2.5 points) Give an example of volatile and non-volatile storage devices RAM – volatile, Hard disk – non-volatile memory CMPE242 Operating Systems Q.2. (10 pts.) Fill in the blanks of the following sentences: a) ………OS………… is a program that acts as an intermediary between a user of a computer and the computer hardware. b) CPU Scheduling choose among several jobs ready to run. The system must know their exact locations in memory. c) In computer systems generally we have two communication models. With these models communication may take place using either Msg Passing or Shared Memory . d) The long-term scheduler controls the degree . This corresponds to the number of processes in memory. e) CPU_bound process – spends more time doing computations; few I/O, very long CPU bursts. f) PCB holds the information associated with each process. Q.3. (10 pts) Below there is a diagram of process states and transitions between them. Fill in entries 1. - 11. CMPE242 Operating Systems Q.4. (15 pts.) Consider Algorithm 1 – Strict Alternation Approach Shared variables: int turn; initially turn = 0 turn = i Pi can enter its critical section Process Pi Process Pj do { do { while (turn != i) ; critical section turn = j; reminder section } while (true); while (turn != j) ; critical section turn = i; reminder section } while (true); This solution does not satisfy the progress requirement: If Pi wants to enter its critical section, and turn is j, then it can not even if Pj may be executing in its remainder section a) (6 points) What the progress requirement is? Give its definition Processes executing in their remainder sections shall not affect on the decision of entering a critical section by the waiting it processes. Waiting of entering shall not be indefinite b) (9 points) Give an example of scenario of the two processes execution (what each process does in time) leading to the violation of the progress requirement Let the process P0 passes the critical section, and sets turn=1. Then the process P1 passes the critical section, and sets turn=0 while the process P0 is still in its remainder section. Let P1 quickly process its remainder section and tries to enter the critical section, but it can not enter since turn=0, and P0 is still in its remainder section. Hence, P1 willing to enter the critical section depends on P0 being in its remainder section, that violates the progress requirement CMPE242 Operating Systems Q.5.( 15 pts) The processes A, B and C are given below. Synchronize the processes in the following execution order: produce1 , produce3, produce2, produce4, and produce5 Shared data: Semaphore ...S1=1;S2=0;S3=0;S4=0;.S5=0;.................................................... Process A: { Process B: { Process C: { Wait(S1); Wait(S2); Wait(S3); //produce1; Signal(S3); //produce2; Signal(S4); Wait(S4); //produce4; Signal(S5); } //produce3; Signal(S2); Wait(S5); //produce5; Signal(S1); } } CMPE242 Operating Systems Q.6. (15 pts) Consider the following set of processes: Process ID P1 P2 P3 Arrival Time 0 3 5 4 P4 CPU Burst Time (ms) 9 3 5 2 a) Draw Gantt chart illustrating the execution of these processes using the First Come First Serve (FCFS) algorithm. (9 points) P1 1 P4 P2 2 3 4 5 6 7 8 9 0 1 2 3 P3 4 5 6 7 8 9 b) Calculate mean waiting time, mean turn-around time, and CPU utilization. Show details of your calculations (6 points) W(P1)=0, W(P2)=6, W(P3)=9, W(P4)=8, W=(0+6+9+8)/4=5.75 Tot(P1)=9, Tot(P2)=9, Tot(P3)=14, Tot(P4)=10, Tot=(9+9+14+10)/4=10.5 U=19/19*100%=100% CMPE242 Operating Systems Q.7. (15 pts) Consider the following set of processes: Process ID P0 P1 P2 Arrival Time 2 1 0 CPU Burst Time 1 3 5 I/O Burst Time 1 7 2 CPU Burst Time 2 1 1 c) Draw Gantt charts illustrating the execution of these processes using the Shortest Remaining Time First (SRTF) algorithm. (note: I/O device uses FCFS scheduling) P2| P1| P0| P1 0 1 2 3 | P0 5 | P0 | | | P2| | P1| 7 | P2 11 12 13 14 15 P1 | P2 | 0 d) Based on your work above, fill in the table below giving both the waiting time (Wait) and turnaround time (tat) for each process: Scheduling Algorithm Parameter P0 SRTF Wait 1 Tat Process ID P1 P2 1 6 12 15 5 c) Calculate the CPU utilization. (13/15)x100 CMPE242 Operating Systems