OS Final Exam
OS Final Exam
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
2 Parallel computing supports more than one task making progress. [F]
11 Turnaround time is an amount of time a process has been waiting in the ready [F]
queue.
14 Shortest-remaining-time-first is the non-preemptive version of SJF scheduling. [F]
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 & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
21 Virtual address is an alternative name to the physical address in which both [F]
generated by CPU.
22 In modern OS the swapping technique is disabled as default and can [F]
be used unconditionally.
23 Internal Fragmentation can be solved by either compaction or paging [F]
approaches.
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 & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
3
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
4
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of 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.
5
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
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
6
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
7
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
When parent and child processes want to initially share the same pages in memory.
35 When and why page replacement is needed?
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=1
3
P2=1
8
P3=2
5
P4=2
8
3- Average turnaround time= (13+18+25+28)/4=21
9
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of 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
10
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of 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
600K P2 P2 P2
B
500K P1 P1 P1
B
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
11
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of 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
12
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
13
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
6 FRAMES
FIFO algorithm:
1 2 3 64 2 1 5 2 1 2 3 7 6 3 2 1 2 3 6
1 1 1 11 1 7 7 7 7
2 2 22 2 2 1 1 1
3 33 3 3 3 2 2
44 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 64 2 1 5 2 1 2 3 7 6 3 2 1 2 3 6
1 1 1 11 1 1
2 2 22 2 2
3 33 3 3
44 4 7
5 5 5
6 6
Number of Page faults= ……7….
LRU algorithm:
1 2 3 4 6 2 1 5 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….
14
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of 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
15
Yemen of Republic الجمهورية اليمنية
Ministry of Higher Education & Research وزارة التعليم العالي و البحث العلمي
Scientific International University of Twintech جامعة تونتك الدولية لتكنولوجيا
16