SlideShare a Scribd company logo
Name:____________________________________ ID:___________________
1
Addis Ababa University
Institute of Technology
Information Technology and Scientific Computing
2013, First Semester Lisanu Tebikew
Sample Mid-Term Exam
Nov 30, 2013
ITSC 4931 Operating Systems
Your Name:
ID Number:
1. This is a closed book exam. You may not use any reference materials
during the exam; if you have any notes on you please put them away.
2. You have 3 hours to complete as much of the exam as possible.
3. Answer all questions directly on the space provided bellow each
question. The weight of each question is indicated at the beginning of
each question in parentheses.
4. Make your answers as concise as possible. You will receive partial
credit for partially correct answers.
5. Write your name on this cover sheet AND at the top of each page of
this booklet, since some pages might get detached.
6. If there is something about the questions that you believe is open to
interpretation, please ask the instructor about it!
Don’t Begin The Exam Until You Are Told To Do So!
Good Luck!!
Name:____________________________________ ID:___________________
2
Part I: Threads
1. (2 points) What are the main functions of an operating system?
2. (4 points) How are “user mode” and “kernel mode” different? How are
they important to Operating systems? Name three ways in which the
processor can transition from user mode to kernel mode. Can the user
execute arbitrary code after transitioning?
3. Give a brief definition for each of the following terms as they apply to
this course.
a. (2 Points) Register
b. (2 points) Stack
c. (2 points) System call
d. (2 points) program counter
4. (4 points) What is an interrupt, briefly describe the steps that the
computer system performs to handle an interrupt.
5.
a. (2 points) What is Context switching?
b. (2 points) Describe the General steps needed to perform Context
switching?
6. (2 points) Assume that you wanted to write a C program which will
write zeroes throughout the address space of your Linux computer’s shell
program (i.e., bash). To your sadness you discover that the operating
system has placed a hardware barrier in your path. How does the computer
hardware prevent the program you are going to write from accessing
memory that doesn’t belong to it?
Name:____________________________________ ID:___________________
3
Running
New Ready
Waiting
Terminated
7. (6 points) Here are nodes for three states a process can be in. Draw
directed arcs (i.e., arrows) between the nodes to indicate all transitions a
process can use (For example, draw an arc from Ready to New if a process
can go from being Ready to being Newly created). Label each arc with a 1-
word summary term (how that transition occurs) and then, below the figure,
provide a brief explanation of why such a transition happens (1 or 2
sentences should suffice) of what you meant by each summary term.
8. (4 points) Consider the following program? What would its output be?
(Hint: the echo program displays whatever is given to it to the screen)
int main(int argc, char *argv[]) {
int child_pid = fork();
if (child_pid == 0) {
printf(“Child’s id is %dn”, getpid());
execl(“/bin/echo”,”echo”,”Hello there”,NULL);
return 0;
}
else {
printf(“My child is %dn”, child_pid);
return 0;
}
}
Name:____________________________________ ID:___________________
4
9. (2 point) Suggest one program that can use multiple threads to do many
things at once?
10. (8 points) Consider a multithreaded program (a process having many
threads).
For the components of the program listed in the following table put an X
mark under the Private column if that resource is private to each thread and
Put an X mark under the Shared column if that resource is shared between
threads of the same process.
Component Private Shared
Program Counter
Register values
Program’s Code
Program’s Data (Global Variables)
Program’s Heap
Program’s Stack
Operating System resources such as
files, network connections
Program’s State (whether it is Ready,
Blocked, Waiting)
Part II: Synchronization
11. Suppose a thread is running in a critical section of code, meaning that
it has acquired all the locks through proper arbitration. Can it get context
switched? Why or why not?
12. Show how to implement a Semaphore using a Lock and Condition
Variable). Make sure to implement both methods, P(), and V().
Name:____________________________________ ID:___________________
5
13. (6 points) Observing that building the “Great Ethiopian Dam” needs
everybody’s contribution, a famous bank called EthioBucks has launched
a new system called Bootex. Bootex’s server allows the bank’s customers
to donate 10 Birr to the Great Ethiopian Dam by clicking a button which
says DONATE on Bootex’s web site.
Every such button click Bootex creates another thread which executes a
function called donate. The donate function accepts the customer’s
account number, decrements 10 birr from the customer’s balance, and
updates the customer’s balance.
The donate function is coded as follows.
void donate (int accountNumber){
//Get the sender’s balance by calling another function called
//get_balance.
int balance = get_balance(accountNumber);
//decrement 10 birr from the sender’s account balance
balance = balance – 10;
//update the balance of the phone number
save_balance(accountNumber, balance);
}
Abebe and Kebede, who use the same bank account, are working on
different computers and they simultaneously clicked on the DONATE button.
But when they check their balance they find out that only 10 birr is
deducted. But since the DONATE button was clicked twice; 2 * 10 = 20 birr
should have been deducted.
i. Give a simple scenario involving two threads, T1 and T2( serving
Abebe and Kebede respectively), with interleaved execution that
would result in only 10 Birr being deducted from their account.
Name:____________________________________ ID:___________________
6
ii. (6 points) Describe of how Mutexes can be used to protect critical
sections, and solve problems like the one stated in question 4.1.
14. What is a monitor?
15. What is the difference between Mesa and Hoare scheduling for
monitors?
16. Consider show the Readers-Writers example given in class (Not
Included here on the sample exam due to space constraints, but on the
real exam it is). It used two condition variables, one for waiting readers
and one for waiting writers. Suppose that all of the following requests
arrive in very short order (while R1 and R2 are still executing):
Incoming stream: R1 R2 W1W2R3 R4 R5 W3 R6W4 W5 R7 R8W6 R9
In what order would the above code process the above requests?
Part V: InterProcess Communication and Deadlock
17. Name two ways in which processes on the same processor can
communicate with one another. And explain how each one of them work.
18. What is the difference between a deadlock and a starvation?
19. Does a cyclic dependency always lead to deadlock? Why or why not?
20. List the conditions for deadlock.
21. What are three methods of dealing with the possibility of deadlock?
Explain each method and its consequences to programmer of
applications.
22. The Banker’s algorithm is said to keep the system in a “safe” state.
Describe what a “safe” state is and explain how the Banker’s algorithm
keeps the system in a safe state. Keep your answer short.
Part IV: Scheduling
23. Provide a brief explanation of what are preemptive and non-
preemptive scheduling policies.
24. Name at least three ways in which context-switching can happen in a
nonpreemptive scheduler.
Name:____________________________________ ID:___________________
7
25. Describe how First Come First Served (FCFS), Round Robin (RR),
Shortest Job First (SJF), Shortest Remaining Time First (SRTF) and
Priority Scheduling algorithms work?
26. Why is SJF or SRTF scheduling difficult to implement in a real OS?
27. Here is a table of processes, their arrival time and their associated
running times.
Pricess ID Arrival Time Expected CPU
Running Time
Process ID 0 4
Process 1 1 5
Process 2 3 4
Process 3 4 1
Process 4 7 2
Show the scheduling order for these processes under First-In-First- Out
(FIFO), Shortest-Job First (SJF), and Round-Robin (RR) with a quantum = 1
time unit. Assume that the context switch overhead is 0 and new processes
are added to the head of the queue except for FIFO.

More Related Content

What's hot

Dynamic interconnection networks
Dynamic interconnection networksDynamic interconnection networks
Dynamic interconnection networksPrasenjit Dey
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMSkoolkampus
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazardAJAL A J
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocolsChethanMp7
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control TechniquesRaj vardhan
 
Computer Networks for Computer Science Student
Computer Networks for Computer Science StudentComputer Networks for Computer Science Student
Computer Networks for Computer Science Studentrprajat007
 
Computer network switching
Computer network switchingComputer network switching
Computer network switchingShivani Godha
 
Operating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputOperating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputPeter Tröger
 
IO and file systems
IO and file systems IO and file systems
IO and file systems EktaVaswani2
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsWayne Jones Jnr
 
Direct memory access (dma)
Direct memory access (dma)Direct memory access (dma)
Direct memory access (dma)Zubair Khalid
 
Connection Establishment & Flow and Congestion Control
Connection Establishment & Flow and Congestion ControlConnection Establishment & Flow and Congestion Control
Connection Establishment & Flow and Congestion ControlAdeel Rasheed
 

What's hot (20)

Dynamic interconnection networks
Dynamic interconnection networksDynamic interconnection networks
Dynamic interconnection networks
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
CISC & RISC Architecture
CISC & RISC Architecture CISC & RISC Architecture
CISC & RISC Architecture
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocols
 
Parallel Database
Parallel DatabaseParallel Database
Parallel Database
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
 
Computer Networks for Computer Science Student
Computer Networks for Computer Science StudentComputer Networks for Computer Science Student
Computer Networks for Computer Science Student
 
C#.NET
C#.NETC#.NET
C#.NET
 
Presentation on risc pipeline
Presentation on risc pipelinePresentation on risc pipeline
Presentation on risc pipeline
 
Computer network switching
Computer network switchingComputer network switching
Computer network switching
 
Operating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputOperating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / Output
 
Cs8493 unit 3
Cs8493 unit 3Cs8493 unit 3
Cs8493 unit 3
 
IO and file systems
IO and file systems IO and file systems
IO and file systems
 
Timestamp protocols
Timestamp protocolsTimestamp protocols
Timestamp protocols
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
Chapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage SystemsChapter 12 - Mass Storage Systems
Chapter 12 - Mass Storage Systems
 
Network layer tanenbaum
Network layer tanenbaumNetwork layer tanenbaum
Network layer tanenbaum
 
Direct memory access (dma)
Direct memory access (dma)Direct memory access (dma)
Direct memory access (dma)
 
Connection Establishment & Flow and Congestion Control
Connection Establishment & Flow and Congestion ControlConnection Establishment & Flow and Congestion Control
Connection Establishment & Flow and Congestion Control
 

Viewers also liked

Health care prevention emiley reed
Health care prevention emiley reedHealth care prevention emiley reed
Health care prevention emiley reedEmiley Reed
 
Maker faire 期末報告
Maker faire 期末報告Maker faire 期末報告
Maker faire 期末報告Lindsay Tseng
 
Danske kreds 0115WEB
Danske kreds 0115WEBDanske kreds 0115WEB
Danske kreds 0115WEBRasmus Hach
 
Leung-LokYin-6155-P-Futurewise Report
Leung-LokYin-6155-P-Futurewise ReportLeung-LokYin-6155-P-Futurewise Report
Leung-LokYin-6155-P-Futurewise Reportlok yin leung
 
Approval Of Mr.Haseebuddin FGPSP-SA-AYC-T-0975
Approval Of Mr.Haseebuddin FGPSP-SA-AYC-T-0975Approval Of Mr.Haseebuddin FGPSP-SA-AYC-T-0975
Approval Of Mr.Haseebuddin FGPSP-SA-AYC-T-0975haseeb uddin
 
Ensayo de Ingeneria Electrica
Ensayo de Ingeneria ElectricaEnsayo de Ingeneria Electrica
Ensayo de Ingeneria ElectricaDiego Yoris
 
Variety of clones santa barbara
Variety of clones santa barbaraVariety of clones santa barbara
Variety of clones santa barbaraPot Valet
 
SurveyProject_Exclusive Relationships
SurveyProject_Exclusive RelationshipsSurveyProject_Exclusive Relationships
SurveyProject_Exclusive RelationshipsSherri Wielgos
 
C. L. Brewer Ascend resume
C. L. Brewer Ascend resumeC. L. Brewer Ascend resume
C. L. Brewer Ascend resumeCandice Ballard
 

Viewers also liked (15)

Health care prevention emiley reed
Health care prevention emiley reedHealth care prevention emiley reed
Health care prevention emiley reed
 
Maker faire 期末報告
Maker faire 期末報告Maker faire 期末報告
Maker faire 期末報告
 
Tenses
TensesTenses
Tenses
 
Danske kreds 0115WEB
Danske kreds 0115WEBDanske kreds 0115WEB
Danske kreds 0115WEB
 
Train sense
Train senseTrain sense
Train sense
 
Leung-LokYin-6155-P-Futurewise Report
Leung-LokYin-6155-P-Futurewise ReportLeung-LokYin-6155-P-Futurewise Report
Leung-LokYin-6155-P-Futurewise Report
 
Sreekanth cv 12-7-15
Sreekanth cv 12-7-15Sreekanth cv 12-7-15
Sreekanth cv 12-7-15
 
Approval Of Mr.Haseebuddin FGPSP-SA-AYC-T-0975
Approval Of Mr.Haseebuddin FGPSP-SA-AYC-T-0975Approval Of Mr.Haseebuddin FGPSP-SA-AYC-T-0975
Approval Of Mr.Haseebuddin FGPSP-SA-AYC-T-0975
 
Questionnaire Results
Questionnaire ResultsQuestionnaire Results
Questionnaire Results
 
Actividad 3.2
Actividad 3.2Actividad 3.2
Actividad 3.2
 
Ensayo de Ingeneria Electrica
Ensayo de Ingeneria ElectricaEnsayo de Ingeneria Electrica
Ensayo de Ingeneria Electrica
 
Variety of clones santa barbara
Variety of clones santa barbaraVariety of clones santa barbara
Variety of clones santa barbara
 
SurveyProject_Exclusive Relationships
SurveyProject_Exclusive RelationshipsSurveyProject_Exclusive Relationships
SurveyProject_Exclusive Relationships
 
C. L. Brewer Ascend resume
C. L. Brewer Ascend resumeC. L. Brewer Ascend resume
C. L. Brewer Ascend resume
 
store_design
store_designstore_design
store_design
 

Similar to Os sample mid exam

Bsc it winter 2013 2nd sem
Bsc it  winter 2013 2nd semBsc it  winter 2013 2nd sem
Bsc it winter 2013 2nd semsmumbahelp
 
parallel Questions & answers
parallel Questions & answersparallel Questions & answers
parallel Questions & answersMd. Mashiur Rahman
 
Knowledge representation and reasoning
Knowledge representation and reasoningKnowledge representation and reasoning
Knowledge representation and reasoningMaryam Maleki
 
Mi0034 database management system
Mi0034   database management systemMi0034   database management system
Mi0034 database management systemStudy Stuff
 
Pune University MCA [Management] 2020-Sample Questions
Pune University MCA [Management] 2020-Sample QuestionsPune University MCA [Management] 2020-Sample Questions
Pune University MCA [Management] 2020-Sample Questionsshailendrashinde9
 
Due 24 August (Friday, 1159 p.m. EDT)Use Module 1 and Book Ch.docx
Due 24 August (Friday, 1159 p.m. EDT)Use Module 1 and Book Ch.docxDue 24 August (Friday, 1159 p.m. EDT)Use Module 1 and Book Ch.docx
Due 24 August (Friday, 1159 p.m. EDT)Use Module 1 and Book Ch.docxjacksnathalie
 
CIS 512 discussion post responses.CPUs and Programming Pleas.docx
CIS 512 discussion post responses.CPUs and Programming Pleas.docxCIS 512 discussion post responses.CPUs and Programming Pleas.docx
CIS 512 discussion post responses.CPUs and Programming Pleas.docxmccormicknadine86
 
Bca winter 2013 2nd sem
Bca winter 2013 2nd semBca winter 2013 2nd sem
Bca winter 2013 2nd semsmumbahelp
 
MC0078 SMU 2013 Fall session
MC0078 SMU 2013 Fall sessionMC0078 SMU 2013 Fall session
MC0078 SMU 2013 Fall sessionNarinder Kumar
 
9th_Computer Full Exercise
9th_Computer Full Exercise 9th_Computer Full Exercise
9th_Computer Full Exercise Naeem Mughal
 
Test03 solution
Test03 solutionTest03 solution
Test03 solutionfmbuthia
 
Python for Machine Learning
Python for Machine LearningPython for Machine Learning
Python for Machine LearningStudent
 
SP Solutions -Adi.pdf
SP Solutions -Adi.pdfSP Solutions -Adi.pdf
SP Solutions -Adi.pdfAdiseshaK
 
SP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdfSP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdfAdiseshaK
 
Cmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comCmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comWilliamsTaylorza48
 
Cmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comCmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comStephenson22
 

Similar to Os sample mid exam (20)

Bsc it winter 2013 2nd sem
Bsc it  winter 2013 2nd semBsc it  winter 2013 2nd sem
Bsc it winter 2013 2nd sem
 
parallel Questions & answers
parallel Questions & answersparallel Questions & answers
parallel Questions & answers
 
Knowledge representation and reasoning
Knowledge representation and reasoningKnowledge representation and reasoning
Knowledge representation and reasoning
 
Mi0034 database management system
Mi0034   database management systemMi0034   database management system
Mi0034 database management system
 
Pune University MCA [Management] 2020-Sample Questions
Pune University MCA [Management] 2020-Sample QuestionsPune University MCA [Management] 2020-Sample Questions
Pune University MCA [Management] 2020-Sample Questions
 
Due 24 August (Friday, 1159 p.m. EDT)Use Module 1 and Book Ch.docx
Due 24 August (Friday, 1159 p.m. EDT)Use Module 1 and Book Ch.docxDue 24 August (Friday, 1159 p.m. EDT)Use Module 1 and Book Ch.docx
Due 24 August (Friday, 1159 p.m. EDT)Use Module 1 and Book Ch.docx
 
CIS 512 discussion post responses.CPUs and Programming Pleas.docx
CIS 512 discussion post responses.CPUs and Programming Pleas.docxCIS 512 discussion post responses.CPUs and Programming Pleas.docx
CIS 512 discussion post responses.CPUs and Programming Pleas.docx
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
 
Bca winter 2013 2nd sem
Bca winter 2013 2nd semBca winter 2013 2nd sem
Bca winter 2013 2nd sem
 
MC0078 SMU 2013 Fall session
MC0078 SMU 2013 Fall sessionMC0078 SMU 2013 Fall session
MC0078 SMU 2013 Fall session
 
9th_Computer Full Exercise
9th_Computer Full Exercise 9th_Computer Full Exercise
9th_Computer Full Exercise
 
Test03 solution
Test03 solutionTest03 solution
Test03 solution
 
midterm_fa07.pdf
midterm_fa07.pdfmidterm_fa07.pdf
midterm_fa07.pdf
 
Python for Machine Learning
Python for Machine LearningPython for Machine Learning
Python for Machine Learning
 
Higher Homework
Higher HomeworkHigher Homework
Higher Homework
 
SP Solutions -Adi.pdf
SP Solutions -Adi.pdfSP Solutions -Adi.pdf
SP Solutions -Adi.pdf
 
SP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdfSP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdf
 
SP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdfSP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdf
 
Cmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.comCmis 102 Success Begins / snaptutorial.com
Cmis 102 Success Begins / snaptutorial.com
 
Cmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.comCmis 102 Enthusiastic Study / snaptutorial.com
Cmis 102 Enthusiastic Study / snaptutorial.com
 

Recently uploaded

Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfVivekanand Anglo Vedic Academy
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFVivekanand Anglo Vedic Academy
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsCol Mukteshwar Prasad
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chipsGeoBlogs
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online PresentationGDSCYCCE
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportAvinash Rai
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxShajedul Islam Pavel
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfjoachimlavalley1
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptxmansk2
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxDenish Jangid
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfTamralipta Mahavidyalaya
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxssuserbdd3e8
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Forest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDFForest and Wildlife Resources Class 10 Free Study Material PDF
Forest and Wildlife Resources Class 10 Free Study Material PDF
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 

Os sample mid exam

  • 1. Name:____________________________________ ID:___________________ 1 Addis Ababa University Institute of Technology Information Technology and Scientific Computing 2013, First Semester Lisanu Tebikew Sample Mid-Term Exam Nov 30, 2013 ITSC 4931 Operating Systems Your Name: ID Number: 1. This is a closed book exam. You may not use any reference materials during the exam; if you have any notes on you please put them away. 2. You have 3 hours to complete as much of the exam as possible. 3. Answer all questions directly on the space provided bellow each question. The weight of each question is indicated at the beginning of each question in parentheses. 4. Make your answers as concise as possible. You will receive partial credit for partially correct answers. 5. Write your name on this cover sheet AND at the top of each page of this booklet, since some pages might get detached. 6. If there is something about the questions that you believe is open to interpretation, please ask the instructor about it! Don’t Begin The Exam Until You Are Told To Do So! Good Luck!!
  • 2. Name:____________________________________ ID:___________________ 2 Part I: Threads 1. (2 points) What are the main functions of an operating system? 2. (4 points) How are “user mode” and “kernel mode” different? How are they important to Operating systems? Name three ways in which the processor can transition from user mode to kernel mode. Can the user execute arbitrary code after transitioning? 3. Give a brief definition for each of the following terms as they apply to this course. a. (2 Points) Register b. (2 points) Stack c. (2 points) System call d. (2 points) program counter 4. (4 points) What is an interrupt, briefly describe the steps that the computer system performs to handle an interrupt. 5. a. (2 points) What is Context switching? b. (2 points) Describe the General steps needed to perform Context switching? 6. (2 points) Assume that you wanted to write a C program which will write zeroes throughout the address space of your Linux computer’s shell program (i.e., bash). To your sadness you discover that the operating system has placed a hardware barrier in your path. How does the computer hardware prevent the program you are going to write from accessing memory that doesn’t belong to it?
  • 3. Name:____________________________________ ID:___________________ 3 Running New Ready Waiting Terminated 7. (6 points) Here are nodes for three states a process can be in. Draw directed arcs (i.e., arrows) between the nodes to indicate all transitions a process can use (For example, draw an arc from Ready to New if a process can go from being Ready to being Newly created). Label each arc with a 1- word summary term (how that transition occurs) and then, below the figure, provide a brief explanation of why such a transition happens (1 or 2 sentences should suffice) of what you meant by each summary term. 8. (4 points) Consider the following program? What would its output be? (Hint: the echo program displays whatever is given to it to the screen) int main(int argc, char *argv[]) { int child_pid = fork(); if (child_pid == 0) { printf(“Child’s id is %dn”, getpid()); execl(“/bin/echo”,”echo”,”Hello there”,NULL); return 0; } else { printf(“My child is %dn”, child_pid); return 0; } }
  • 4. Name:____________________________________ ID:___________________ 4 9. (2 point) Suggest one program that can use multiple threads to do many things at once? 10. (8 points) Consider a multithreaded program (a process having many threads). For the components of the program listed in the following table put an X mark under the Private column if that resource is private to each thread and Put an X mark under the Shared column if that resource is shared between threads of the same process. Component Private Shared Program Counter Register values Program’s Code Program’s Data (Global Variables) Program’s Heap Program’s Stack Operating System resources such as files, network connections Program’s State (whether it is Ready, Blocked, Waiting) Part II: Synchronization 11. Suppose a thread is running in a critical section of code, meaning that it has acquired all the locks through proper arbitration. Can it get context switched? Why or why not? 12. Show how to implement a Semaphore using a Lock and Condition Variable). Make sure to implement both methods, P(), and V().
  • 5. Name:____________________________________ ID:___________________ 5 13. (6 points) Observing that building the “Great Ethiopian Dam” needs everybody’s contribution, a famous bank called EthioBucks has launched a new system called Bootex. Bootex’s server allows the bank’s customers to donate 10 Birr to the Great Ethiopian Dam by clicking a button which says DONATE on Bootex’s web site. Every such button click Bootex creates another thread which executes a function called donate. The donate function accepts the customer’s account number, decrements 10 birr from the customer’s balance, and updates the customer’s balance. The donate function is coded as follows. void donate (int accountNumber){ //Get the sender’s balance by calling another function called //get_balance. int balance = get_balance(accountNumber); //decrement 10 birr from the sender’s account balance balance = balance – 10; //update the balance of the phone number save_balance(accountNumber, balance); } Abebe and Kebede, who use the same bank account, are working on different computers and they simultaneously clicked on the DONATE button. But when they check their balance they find out that only 10 birr is deducted. But since the DONATE button was clicked twice; 2 * 10 = 20 birr should have been deducted. i. Give a simple scenario involving two threads, T1 and T2( serving Abebe and Kebede respectively), with interleaved execution that would result in only 10 Birr being deducted from their account.
  • 6. Name:____________________________________ ID:___________________ 6 ii. (6 points) Describe of how Mutexes can be used to protect critical sections, and solve problems like the one stated in question 4.1. 14. What is a monitor? 15. What is the difference between Mesa and Hoare scheduling for monitors? 16. Consider show the Readers-Writers example given in class (Not Included here on the sample exam due to space constraints, but on the real exam it is). It used two condition variables, one for waiting readers and one for waiting writers. Suppose that all of the following requests arrive in very short order (while R1 and R2 are still executing): Incoming stream: R1 R2 W1W2R3 R4 R5 W3 R6W4 W5 R7 R8W6 R9 In what order would the above code process the above requests? Part V: InterProcess Communication and Deadlock 17. Name two ways in which processes on the same processor can communicate with one another. And explain how each one of them work. 18. What is the difference between a deadlock and a starvation? 19. Does a cyclic dependency always lead to deadlock? Why or why not? 20. List the conditions for deadlock. 21. What are three methods of dealing with the possibility of deadlock? Explain each method and its consequences to programmer of applications. 22. The Banker’s algorithm is said to keep the system in a “safe” state. Describe what a “safe” state is and explain how the Banker’s algorithm keeps the system in a safe state. Keep your answer short. Part IV: Scheduling 23. Provide a brief explanation of what are preemptive and non- preemptive scheduling policies. 24. Name at least three ways in which context-switching can happen in a nonpreemptive scheduler.
  • 7. Name:____________________________________ ID:___________________ 7 25. Describe how First Come First Served (FCFS), Round Robin (RR), Shortest Job First (SJF), Shortest Remaining Time First (SRTF) and Priority Scheduling algorithms work? 26. Why is SJF or SRTF scheduling difficult to implement in a real OS? 27. Here is a table of processes, their arrival time and their associated running times. Pricess ID Arrival Time Expected CPU Running Time Process ID 0 4 Process 1 1 5 Process 2 3 4 Process 3 4 1 Process 4 7 2 Show the scheduling order for these processes under First-In-First- Out (FIFO), Shortest-Job First (SJF), and Round-Robin (RR) with a quantum = 1 time unit. Assume that the context switch overhead is 0 and new processes are added to the head of the queue except for FIFO.