operating systems
DESCRIPTION
Operating Systems. Review. Questions. What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?. Questions. What causes OS to change? Or, why aren’t we still running MS-DOS? What is a process? What is a file?. True or False. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/1.jpg)
Operating Systems
Review
![Page 2: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/2.jpg)
Questions
• What are two functions of an OS?
• What “layer” is above the OS?
• What “layer” is below the OS?
![Page 3: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/3.jpg)
Questions
• What causes OS to change?– Or, why aren’t we still running MS-DOS?
• What is a process?
• What is a file?
![Page 4: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/4.jpg)
True or False
• Unix is a “simple structure” OS
• Micro Kernels are faster than other OSes
• Virtual Machines are faster than other OSes
![Page 5: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/5.jpg)
Questions
• Name 3 operating system structures
• Give one advantage of each
• Give one disadvantage of each
![Page 6: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/6.jpg)
Questions
• How does a shell work? Or … arrange the commands in order:wait()pid = fork()exec()gets()while(1) {}
![Page 7: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/7.jpg)
Review
• What is a PCB?
• Usually the PCB is in OS memory only. Assume we put the PCB into a processes address space. What problems might this cause?
![Page 8: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/8.jpg)
Review
• List steps that occur during interrupt
• True or False:– Context switch times happen every 5-10
seconds– Most processes have long CPU burst times
![Page 9: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/9.jpg)
Review
• What is (average) waiting time?
• Explain how SJF works
• True or False:– FCFS is optimal in terms of avg waiting time– Most processes are CPU bound– The shorter the time quantum, the better
![Page 10: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/10.jpg)
Questions
• How does Windows NT/2000 avoid process starvation?
![Page 11: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/11.jpg)
Review
• What is a “race condition”?
• What are 3 properties necessary for a correct “critical region” solution?
• What is Peterson’s Solution?
![Page 12: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/12.jpg)
Possible Outputs?
int main() {
int *num, shm_id
shm_id = shmget(502)
num = (int *) shmat(shm_id)
fork()
*num = *num + 1
printf("%d\n", *num)
}
(Assume shm is0 when firstCreated)
![Page 13: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/13.jpg)
Possible Outputs?
int num = 0;
int main() {
fork();
num = num + 1
printf("%d\n", *num)
}
What if fork() was spawn()?
![Page 14: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/14.jpg)
Review
• What does Test_and_Set do?
• What is one major advantage of semaphores over the Test_and_Set or Peterson’s solution?
![Page 15: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/15.jpg)
Review
• What is the Memory Management Unit?
• What is a relocation register?
• What happens to it during a context switch?
![Page 16: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/16.jpg)
Review
• What are some of the sections in an object module?
• What are some of the steps that occur during linking?
![Page 17: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/17.jpg)
Review
• What is internal fragmentation?
• What is external fragmentation?
• What is compaction?
![Page 18: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/18.jpg)
True or False
• With paging, a process’ logical address spaces is contiguous
• With paging, a process’ physical address spaces is contiguous
• Paging reduces the size of the possible address space used by a process
![Page 19: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/19.jpg)
Review
• Does paging have fragmentation?– No? Then why not?– Yes? Then what kind?
• What are the overheads associated with paging?
![Page 20: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/20.jpg)
Another Paging Example
• Consider:– 8 bits in an address– 3 bits for the frame/page number
• How many bytes (words) of physical memory?
• How many frames are there?
• How many bytes is a page?
• How many bits for page offset?
• If a process’ page table is 12 bits, how many logical pages does it have?
![Page 21: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/21.jpg)
Review
• What is run-time, dynamic linking?
![Page 22: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/22.jpg)
Review• True or False:
a) The logical address space cannot be bigger than the physical address space
b) Processes have big address spaces because they always need them
• Demand paging:a) Is unrelated to basic pagingb) Brings logical pages into physical memory
when requested by a processc) Increases memory requirements for a systemd) All of the abovee) None of the above
![Page 23: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/23.jpg)
First-In-First-Out (FIFO)
1
2
3
3 Frames / Process
1,2,3,4,1,2,5,1,2,3,4,5
4
1
2
5
3
4
9 Page Faults
How man page faults would we have if we had4 Frames/Process?
![Page 24: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/24.jpg)
Review• Page faults
– What is a page fault?– What does an OS do during a page fault?
• What is a Page Replacement Algorithm?– What is “Belady’s Anomaly”?– How does the Optimal algorithm work?– How does Enhanced Second Chance work?
• What is thrashing?– How do we fix it?
![Page 25: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/25.jpg)
Page Replacement Algorithms: Counting
• Keep a counter of number of references– LFU - replace page with smallest count
+ Can decay values by shift
– MFU - replace page with largest count+ smallest count just brought in and will probably be
used
• Problems?
![Page 26: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/26.jpg)
Review
• What is a file descriptor?– What information must it contain?– What information might it contain?
![Page 27: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/27.jpg)
Linked-List with Index
• How many files are there?
• How large are they?
• How many free blocks are there?
PhysicalBlock
0
1
null2
null3
74
5
36
27
![Page 28: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/28.jpg)
I-Node
• How many data blocks are there?
• If you added 3 more data blocks to the file, what would happen?D
isk
bloc
ks
i-node
null
null
null
null
null
62
77
![Page 29: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/29.jpg)
Review
• Directories:– In what way is a directory different than a file?
– In what way is a directory similar to a file?
• Aliases:– Describe a hard-link
– Describe a soft-link
• Free space management:– What are two common methods of keeping track of free
blocks?
![Page 30: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/30.jpg)
Flo00
• What is journaling? How is it used in modern file systems?
• How do large disks cause problems for some file systems? How are those problems addressed in modern file systems?
![Page 31: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/31.jpg)
SCG+00
• What are three classes of applications handled by typical OSes?
• What components does QLinux provide?
![Page 32: Operating Systems](https://reader036.vdocuments.mx/reader036/viewer/2022062517/56812df1550346895d934fef/html5/thumbnails/32.jpg)
SCG+00 • What are the two classes used in this test?
• Draw conclusions from the graph