Week 1 and 2 Flashcards
What is an operating system?
A program that acts as an intermediary between a user and the computer hardware
Def: Resource Allocator
Manage and allocate resources. Provide a uniform interface to similar hardware.
Def: Control Program
Controls the execution of user programs. Controls operation of I/O devices (i.e. disk)
Def: Kernel mode
The one program running at all times. IPL - initial program load
- System operations including user requests
Single Program System vs. Multiprogram System
Single: Early batch mainframe system > pool of jobs each run sequentially, single process at a time. CPU is idle while waiting for I/O (waster cycles)
Multi: Later Batch Mainframe system, pool of jobs (more than one program in memory at a time) When one program is doing I/O, another gets the CPU
What are tightly coupled Parallel systems? advantages? symmetric vs asymmetric?
Processes share memory and I/O
Advantages: increased throughput, reliability
Symmetric: each processor identical, process run on whatever processor is available (may one on more than one during its lifetime)
Asymmetric: Master-slave relationship
What are distributed systems? Advantage?
Distribute computation among several processors (loosely coupled > each process has own memory, I/O devices, communication infrastructure)
Advantages: resource sharing/ load sharing, reliability
Hard real-time systems vs Soft real-time systems?
Hard: hard limits that must be met or the system fails
Soft: A missed deadline does not mean system failure, but value of result decreases with time
Def: Interrupts
Can happen at any time
- Suspends execution of the current program (saves current execution location)
- Transfers control to the interrupt routine
- Determines which controller generated the interrupt (polling, vectored Interrupts)
Def: Traps
Traps are like interrupts, but are generated by the program execution (i.e. Divide by zero)
What is the difference between a Synchronous I/O and an Asynchronous?
Synchronous: control returns to program only after I/O is complete, common in multi user systems
Asynchronous: return directly to program, common in single user system
Def: Main Memory
memory CPU can access directly
Def: Secondary storage
- large nonvolatile storage
- hard disks in the middle
Def: Cache
Very high-speed memory that sits between a processor and main memory. Used to hold recent memory values.
What are the three types of Hardware protection?
Memory protection (user limited to memory allocated for its process) I/O Protection (can only have access if in kernel mode - requires special access) CPU Protection (Way for all programs to use CPU without it disturbing anything aka cooperative multitasking)
Def: User Mode
user program doing user computation
Def: Process
A program in execution and all of the required resources to run that instance of the program
What are some OS activities?
- Process creation and deletion
- Suspension and resumption
- Synchronization and communication
- allocation/ deallocating and keeping track of memory
- deciding which process to load
Def: Memory
a continuous sequence of bytes each of which has own address
Def: File
A collection of related information (can be structured or unstructured)
What is I/O management?
Hide specifics of devices behind device drivers
What is the command interpreter?
- user interface
- accepts commands and executes them
- sometimes built into the system and sometimes separate
What are system calls?
The interface between the running process and the operating system (like most function calls take an argument and return a value)
What are the three communication models?
- Interprocess communication (mechanism an os provides to allow processes to manage shared data - other processes need to communicate)
- Message Model (Os system provides message passing facility)
- Shared memory model (Both processes access same memory)
Def: virtualization
multiprocessing creates the illusion that there is more than one CPU
What is the PCB?
Process Control Block: Repository for information that varies from process to process
- one allocated for each process and sometimes each thread
- (some operating systems have a pre-allocated number of them, that is an array)
Def: Context Switch
Utilizes the PCB to switch between processes due to an interrupt or system call
Def: Ready Queue, device Queue, suspend Queue
Ready Queue: All process ready to run
Device Queue: All process waiting for I/O
Suspend Queue: All process that have been suspended
True or False: Processors on the Wait Queue are waiting Queue are waiting for the CPU
False: processes on the Wait Queue are waiting for I/O to complete
Independent processes vs cooperating processes?
Independent processes cannot affect or be affected by other processes
Cooperating processes can affect or be affected by other processes (ex: producer generates info that is passed to a consumer process)
Unbound buffer vs bounded buffer?
Unbound: assumes no bounds on size of buffer used to share data - sender never needs to wait (resource intensive, no guaranteed delivery)
Bounded: there is a limit - sender may need to wait or abandon message
What is interprocess communication?
Mechanism for processes to communicate and synchronize their actions
What is Direct communication? Advantages/ Disadvantages?
Processes explicitly identify each other
adv: simple to implement
dis: processors have to identify each other (has to be some other file you read with processor id)
What is indirect communication? Advantages/ Disadvantages?
Mailboxes (each mailbox has a unique id, processes share mailboxes)
Only 1 process to read mailbox, first come - first serve- multiple receivers
adv: don’t have to know id of other process, can preconfigure which mailbox used and everyone uses it, mailbox gets mail and don’t need to know whos picking up mail
dis: more complex/ harder to implement (need to build storage system where processors can communicate)
What are threads?
Lightweight processes
What are user threads? Adv? Dis?
Threads implemented by a library (os is unaware of)
adv: fast, no system call, simple scheduling
dis: one thread blocks (I/O, IPC) all threads block, no multiprocessing support
What are kernel threads? Adv? Dis?
Threads provided by the operating system (only diff from user is in context switch and killing a given process kills all threads)
adv: OS only blocks threads doing a system call, MP support
dis: not as fast as user level threads, resource intensive
What are the three thread models?
Many to one (all threads mapped to a single kernel thread)
One to one (each program level thread gets a kernel thread)
Many to many (limit the number of kernel threads so still more program level then kernel)
What is the race condition?
to do with process synchronization
- several processes handle shared resources
- final value depends on who finsihes first
To prevent concurrent processes must be synchronized)
Def: Critical sections
several processes competing for access to some shared data (the sections of data where the shared data is accessed/ modified) - each process has its own
What are the 3 critical section requirements?
- Mutual Exclusion - only one
- Progress - if there is no process in a critical section, and more than one process wants to enter their critical section, then the selection of the process cannot be postponed indefinitely
- Bounded Waiting - once a process is waiting, the other process can only enter and leave a bounded number of times (no starvation)