OS Final Exam
OS Final Exam
2 Parallel computing supports more than one task making progress. [F]
3 Distributes subsets of the same data across multiple cores, same operation on each is [T]
type of data parallelism
5 In one-to-one multithreaded model, creating a user-level thread leads to creates a kernel [T]
thread.
6 Two-level Model is similar to Many-to-Many Model except that it allows a user thread to [T]
be bound to kernel thread.
10 Throughput is the number of processes that complete their execution per time unit. [T]
11 Turnaround time is an amount of time a process has been waiting in the ready queue. [F]
12 Convoy effect is that the long process comes before the short process. [T]
13 Shortest-Job-First (SJF) Scheduling is an optimal algorithm, but with the difficulty [T]
knowing the length of the next CPU request.
15 Starvation problem appears in which the low priority processes may never executed. [ T]
16 Multiple threads per core take advantage of memory stall to make progress on another [T]
thread while memory retrieve happens.
17 A soft real-time system means that the task must be serviced by its deadline. [F]
1
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
18 Scheduling Algorithm Optimization Criteria include but not limited to; maximizing [T]
CPU utilization and minimizing throughput.
21 Virtual address is an alternative name to the physical address in which both generated [F]
by CPU.
22 In modern OS the swapping technique is disabled as default and can be used [F]
unconditionally.
23 Internal Fragmentation can be solved by either compaction or paging approaches. [F]
24 External Fragmentation – total memory space exists to satisfy a request, but it is not [T]
contiguous
25 When page fault occurs, it causes an interrupt (trap) to OS to serve the page request. [T]
26 Page fault for every process page on first access called pure demand paging. [T]
Q2: Answer the following questions based on your knowledge and understanding (short answer)
1 What is the relation between passive and active entity? When the program becomes
process?
Passive entity is program stored on disk
Process is active
Process – a program in execution;
Program becomes process when executable file loaded into memory
2
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
3
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
Data parallelism: distributes subsets of the same data across multiple cores, same operation on
each.
Task parallelism: distributing threads across cores, each thread performing unique operation.
13 Assume that, there are 12 tasks, show how these tasks can be executed on single-
core system and 3-cores system? (draw figure to explain the idea)
Single Core
T1 T4 T7 T10
T2 T5 T8 T11
T3 T6 T9 T12
4
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
5
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
When parent and child processes want to initially share the same pages in memory.
35 When and why page replacement is needed?
6
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
Process Burst
Time
P1 13
P2 5
P3 7
P4 3
Suppose that the processes arrive as: P1, P2, P3 and P4.
1. Draw Gantt chart to schedule aforementioned processes based on
FCFS algorithm.
2. Compute the turnaround time for each process.
3. Compute the average turnaround time.
1-
P1 P2 P3 P4
0 13 18 25 28
2-
p1=13
P2=18
P3=25
P4=28
3- Average turnaround time= (13+18+25+28)/4=21
7
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
P1 0 10
P2 2 7
P3 5 3
P4 6 2
a- Non-preemptive
P1 P4 P3 P2
0 10 12 15 22
b- Preemptive
P1 P2 P3 P4 P2 P1
0 2 5 8 10 14 22
8
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
3 Given two memory partitions of 600 KB and 500 KB (in order); and two processes
p1=350 KB, and p2=540 KB.
Answer the following questions accordingly.
1- How would each of the first-fit, best-fit, and worst-fit algorithms place the
processes?
a- p1 and p2 came in order.
b- p1 and p2 came in
reverse order.
A-In order
B-Reverse order
600KB P2 P2 P2
500KB P1 P1 P1
4 Given the following datum; calculate the internal fragmentation and the number of pages needed for
process p.
Process size = 51M.
Page size = 4M.? number of pages = process size / page size
Number of pages= 51/ 4 =12.75 so the required pages is 13 12 *4 = 48 51- 48=3
Internal fragmentation = 4 - 3 = 1m
9
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
5 Computer the Effective Access Time (EAT) when the associative memory used with
the following datum:
Hit rate α= 93%, EAT = hit rate(a) * memory Access + 7% * Associative lookup E
Associative lookup ε= 10 ns for TLB search,
And 0.1 microsecond for memory access
0.1*1000=100ns
EAT=0.93*100+0.10*10=94ns
6 Compute the Effective Access Time (EAT) using Demand Paging mechanism if the
following info. given:
(unit in nanoseconds for all)
Memory access time = 400 nanoseconds.
Average page-fault service time = 4000
microseconds. One-page fault happens per
10,000 accesses.
4000 *1000 = 4,000,000
EAT = (1-P) * memory access time + P * page fault time
1
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
1
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
6 FRAMES
FIFO algorithm:
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 1 1 1 1 1 7 7 7 7
2 2 2 2 2 2 1 1 1
3 3 3 3 3 3 2 2
4 4 4 4 4 4 3
5 5 5 5 5 5
6 6 6 6 6
Number of Page faults= ……10….
Optimal Algorithm:
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3
4 4 4 7
5 5 5
6 6
Number of Page faults= ……7….
LRU algorithm:
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3
4 4 4 7
5 5 5
6 6
Number of Page faults= ……7….
1
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا
7FRAMES
FIFO algorithm:
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3
4 4 4 4
5 5 5
6 6
7
Number of Page faults=7
Optimal Algorithm:
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3
4 4 4 4
5 5 5
6 6
7
Number of Page faults=7
LRU algorithm:
1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
1 1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3
4 4 4 4
5 5 5
6 6
7
Number of Page faults=7
1
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & وزارة التعليم العالي و البحث العلمي
Scientific International Research
Twintech جامعة تونتك الدولية للتكنولوجيا