1/45
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What are the two viewpoints/perspectives that operating systems can be viewed?
Bottom-up view OS as resource manager. Top-down OS serves as abstraction layer over hardware. Look at interfaces that serve hardware
To use cache memory, main memory is divided into cache lines, typically 32 or 64 bytes long. An entire cache line is cached at once. What is the advantages of caching an entire line instead of a single byte or word at a time?
It takes more time to load to a cache. Data declared together is often accessed together so loading the entire block into cache reduces future memory access
On early computers, every byte of data read or written was handled by the CPU (no DMA Direct Memory Access) What implications does this have for multiprogramming?
Some registers will override and change information, thus they need to coordinate what registers are being used. In addition, CPU handles all I/O transfers wasting CPU time and reducing efficiency of multiprogramming since fewer CPU cycles are available for running other programs
There are several design goals in building an OS. What are two design goals that may contradict one another?
Security contradicts convenience because extra security may take longer to do tasks
On all current computers, at least part of interrupt handlers are written in assembly. Why?
Because memory is finite and low level programs need to be done fast when switching between programs. Requires precise low level control of hardware and CPU registers during interrupts
To a programmer, a system call looks like any other call to a library procedure. Is it important that a programmer knows which library procedures result in syscalls? Under what circumstances and why?
Yes because User inputs should be sanitized if used and error handling should be done. In addition performance matters since switching between user space and kernel space is expensive. Important under performance critical systems or security systems since working with the kernel.
Instructions related to accessing I/O devices are typically privileged instructions (executed in kernel mode only) why?
Kernel is the one that actually deals with devices making it simpler. Restricting to kernel mode prevents user programs from directly accessing devices and interfering with the system
Why have a kind of process (threads) within a process?
In many applications multiple activities are happening at once and threads are lighter weight than processes. Substantial computing and I/O allow activities to overlap improving performance. Useful in true hardware parallelism environments
Drawbacks of User Space Threads?
Invisible to kernel and lack of coordination
Why are kernel threads slower to create and manage?
Switching between OS and Kernel
Why should scheduler make efficient use of the CPU?
Because process switching is very expensive
What happens if one process has many children running under its control?
Separate scheduling mechanism from scheduling policy. Scheduling algorithm is parameterized in some way, but the parameters can be filled by user process
When an interrupt or a syscall transfers control from the process to the OS, a kernel stack area separate from the stack of the interrupted process is used. Why?
Integrity, make sure current state is correct. Security since we want to prevent vulnerabilities by validating the stack. This should be done while OS handles the interrupt or syscall.
Why would a thread ever voluntarily give up the CPU by calling thread_yield? After all since there is not periodic clock interrupt, it may never get the CPU back
If a different thread has higher priority and because of synchronization
What happens when you fork?
Program is copied at exact time of execution
How many child processes are created upon execution of the program: void main() { fork(); fork(); exit();}
3 children

What is the biggest advantage of implementing threads in user space?
OS doesn’t have to support it, can manage your own threads, faster to create
What is the biggest disadvantage of implementing threads in user space?
Can’t do true parallelism since kernel doesn’t know
Consider a car as real time system, what events are hard, soft, periodic, and aperiodic
Hard: Airbag deployment during a crash
Soft: backup camera display
Periodic: Engine control checks
Aperiodic events: object detection
On a single CPU system, simplest solution is to have each process disable all interrupts just after entering its critical region and reenable them just before leaving so no clock interrupts can occur. What is the problem?
Can slow down entire system, another process might be as critical, or priority isn’t as high as thought
What are the problems with lock variables?
State of lock might’ve changed
Problems with monitors and semaphores?
Moving to a distributed system consisting of multiple CPUs, each with own private memory and over LAN, no access to a common memory
How does the time quantum value and context switching time affect each other in a round robin scheduling algorithm?
A shorter quantum means more time spend context switching. There is an inverse relationship between the two so we need to find a balance
Consider a system in which it is desired to separate policy and mechanism for the scheduling of kernel threads. Propose a means of achieving this goal
Policy is handled in userland and mechanisms are handled in kernel space
Core problem with swapping?
Don’t know where memory places you and if you have specific jumps, it wouldn’t work with multiple programs
Why is static reallocation bad?
Memory can’t be changed while program is running
Why do radios, washing machines, and microwaves address absolute memory?
No user programs, time doesn’t matter since using nonvolatile memory, no need to use ram, usually only one program is run
Drawbacks of exposing physical memory to processes?
Easily trash the OS and difficult to have multiple programs running at once
What happens if the process is adjacent to another process and can’t grow into that process space?
Move up other process or swap out process to let it grow
What happens if the swap area on the disk/SSD is full?
Terminate a process depending on priority/implementation
What piece of hardware would keeping track of what slots are free in a set of resources be useful for?
Storage
In bitmaps, what is the design issue of allocation is too small or too large?
Too small bitmap too big, Too big parts of memory might be reserved even if not needed
Disadvantage of bitmaps?
Insertion into bitmaps take linear time plus additional searches to find what you need
Paging system issues
Mapping must be fast and page table should not be too large
What kind of hardware support is needed for a paged virtual memory to work?
Need MMU Memory Management Unit which is in CPU and TLB Translation Look Aside Buffer is a part of MMU.
What are two main problems when doing memory management purely off physical memory and with no data abstraction
Protection - Can overwrite past data and Isolation - might access other programs address
Difference between static relocation and dynamic reloocation
Static you add the base yourself while Dynamic CPU adds base value and limit value automatically
Why use next fit?
Improve allocation speed by continuing memory search from last allocation instead of starting from beginning. Reduces repeated scanning of same memory blocks and can make allocation faster
What happens if OS wants to change the bits in a page table entry?
Modify it in memory, but flush the corresponding TLB entry too
How is a page not referenced but modified?
Direct Memory Access (DMA) the device changes the page contents without CPU accessing so modified bit may be set while reference bit is not
The NRU (not recently used) algorithm removes a page at random from the lowest non empty class, why?
Higher classes are more likely to be used in the future
Issues with FIFO replacement algorithm?
Might remove something important
Issue with Least Recently Used replacement algorithm
Increases memory size and page size.
Scheduling can be handled if and only if
Compute/Period < 1
What are the four principal events that cause processes to be created?
System initialization (part of kernel), Execution of a process creation system call by a running process (Fork), a user request to create a new process (launching app on phone), initiation of a batch job (starting a script that starts a bunch of processes)
In page table entry, what bits are important?
Present/absent bit, protection bits, supervisor bit, modified bit, referenced bit, cached bit