



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Class: Computer Arch & Oper Sys; Subject: Electrical & Computer Engr; University: Georgia Institute of Technology-Main Campus; Term: Fall 2006;
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!




1.1. Name the five possible states of a process during a process’ life.
New, Ready, Running, Waiting, Terminate
1.2. Which of the following components can be shared by multiple threads that belong to the same process? (a) Stack pointer; (b) Global data variables; (c) Code; (d) Register file; (e) Program counter
(b) Global data variables and (c) Code
1.3. Is a TLB absolutely necessary for successful address translations? Why?
No. TLB is simply a small cache to capture locality for page table entries.
1.4. When does a page fault take place?
When a memory page is not present in memory (i.e. no translation is found in page table), a page fault is triggered to bring the corresponding page into memory.
1.5. Explain how can “starvation” occur when priority scheduling is applied. Also explain the solution to resolve it.
Low priority processes are never scheduled for CPU time. Aging can be used to promote a lower priority process to higher priority over time.
2.3. (10%) To which “ virtual address ”, of “ which process ”, does the physical address 0x78e968 map? Please derive and write down the complete address in Hex value. If you cannot find a valid mapping, please answer “address not found”.
0x78e968 = 0111 1000 1110 1001 0110 1000 PPN = 011 = 3 Æ the 4th^ entry which has a valid entry with VPN=0x7fd for PID= Virtual address = 0x7fd || 1 1000 1110 1001 0110 1000 Virtual address = 1111 1111 1011 1000 1110 1001 0110 1000 Virtual address = 0xffb8e968 of Process P
2.4. (10%) Now the OS writer decides to use an index-based linear page table for each process. How big (in bits or bytes) the total page tables are needed for these active processes? Assume you have 2 extra bits (valid and dirty) in addition to the PPN for each page table entry.
From 2.2, we know the VPN has 11 bits. In other words, the total number of entries of an index-based linear page table will be 2^11 = 2048 possible translations.
Since there are only 8 pages in physical memory, thus PPN = 3 bits. Each page table entry = 3 + 2 (v and d bits) = 5 bits 5 * 2048 * 3 processes = 15*2K bits = 30Kbits = 3.75KB
Version 1: if (ret_pid == 0 || ret_ppid == 0)
or
Version 2: if (! (ret_pid != 0 || ret_ppid != 0) )
#include <stdio.h> #include <unistd.h>
main() { int ret_pid, ret_ppid; int mypid;
ret_pid = fork(); ret_ppid = fork(); mypid = getpid();
if ( ??? ) { /* All Children/Grandchildren execute here / fprintf(stdout, "Child : mypid is %d\n", mypid); exit(0); } else { / The Master comes here */ fprintf(stdout, "Master: mypid is %d\n", mypid); wait(NULL); exit(0); } }
Ret_pid=C1_pid Ret_pid=
Ret_pid=C1_pid Ret_ppid=C2_pid My_pid=P_pid
Ret_pid=C1_pid Ret_ppid= My_pid=C2_pid
Ret_pid= Ret_ppid=C My_pid=C11_pid
Ret_pid= Ret_ppid= My_pid=C12_pid