Final Flashcards
Explain What CPU Registers are
Fast memory units on the CPU
- split into two categories: control and status registers and user-visible registers
What is the Program Counter
A register which contains the address of the next instruction to be fetched
What is the instruction Register?
Register containing instruction most recently fetched
Explain the Basic Instruction Cycle
- CPU fetches next instruction from memory
- CPU executes instruction
- Program counter is consulted for next instruction and incremented
- CPU must wait for IO to complete
Explain how Interrupts fit into the Instruction cycle
computers allow IO modules to interrupt the CPU. CPU checks for interrupts after each instruction
and if there are none fetches the next instruction from the current program. If an interrupt is found execution of program is suspended and interrupt handling is entered
Explain what an Interrupt Handler is
A program that determines the nature of the interrupt and responds accordingly. It then transfers control of the program back to the stored interrupt point of the program
List the 4 interrupt Classes
IO, Program exception, Timer, Hardware failure
Explain what happens with Multiple interrupts
further interrupts are disabled during an interrupt. Others remain pending until current interrupt is resolved. Interrupts have priority
Explain the three possible Communication techniques for IO operation
- Programmed IO - no interrupts (cpu must wait), IO module preforms actions on processors behalf
- Interrupt-driven IO - CPU can execute code during IO operation: it gets interrupted when IO happens - no needless waiting but takes a lot of processor time watching for interrupts
- Direct memory access - block of data is transferred directly from memory without going through CPU
Explain Cache memory
Small cache of expensive but extremely fast memory which interacts with larger slower memory. Cache is checked first to determine if info is present, if it is, info is used from cache. Otherwise, data is copied from main memory and temporarily stored in the cache
Explain Access Time
Time to bring referenced word into the processor
Access time for cache (T1) + access time for main memory (T2)= total access time (T)
if word in cache T= T1
What is an operating system and what are its goals?
An operating system is a program that acts as an intermediary between a user and the hardware by managing resources and conflicts
Goals:
- Execute user programs
- make the computer convenient
- use hardware efficiently
What is the Kernel
The one program running at all times on the computer. It operates on a different layer than things the user can access and is responsible for providing secure access to machines hardware.
Explain the Computer System Structure
Can be divided into 4 components
Hardware - cpu, memory, IO devices
Operating System - controls and coordinates use of hardware
Application programs - define the ways system resources are used
Users
Explain Storage structure
Main memory (RAM) - only large storage media CPU can directly access (volatile)
Secondary storage - extension of main memory that is non-volatile but can’t be directly accessed by CPU
What are priveleged Instructions?
Instructions that can only be executed in Kernel mode
What is the purpose of System Calls?
System calls allow user-level processes to request services of the operating system. system calls are
implemented using software interrupts. Realize that the OS is interrupt driven and that interrupts are received
both from the hardware and software as requests to perform some action.
Explain the two types of Multiprocessing
Asymmetric Multiprocessing - each processor is assigned a specific task but they are all running simultaneously
Symmetric - each processor performs all tasks
Explain Multi-programming
Multiprogramming organizes jobs so CPU always has one to execute. (a subset of total jobs kept in memory)
one job is selected and run. if a task has to wait on something (say an IO) OS switches to another job
What is a Process?
A process is a program in execution
What activities in regards to process management is the OS responsible for?
-Creating and deleting processes
-suspending and resuming processes
-providing mechanisms for process synchronization and communication
-providing methods to handle deadlocks
List the 5 Process states
new: process being created
running: instructions being executed
waiting: waiting for event
ready: waiting to be assigned to processor
terminated: finished executing
Explain the process control block (PCB)
Info associated with each process
- program counter - process state - Cpu registers - memory allocated to process - accounting info (cpu used, clock time elapsed) - IO devices allocated and open files
Explain the purpose of process scheduling?
Maximizes CPU use by quickly switching processes onto the CPU for time sharing. The process scheduler selects next execution from available processes
What are the three scheduling queues?
Job queue - set of all processes
Ready queue - all processes residing in main memory (ready)
Device queues - set of all processes waiting for an IO device
What are the differences between the long-term scheduler (job scheduler), the short-term scheduler (CPU scheduler) and the medium-term scheduler?
LTS - selects which processes should be brought into the ready queue
- infrequent (seconds, mins) controls the degree of multiprogramming
MTS - can be added if degree of multiprogramming needs to decrease
- performs swapping: removes process from memory and stores it on disk, then brings it back to continue executing
STS - selects which process should be executed next and allocates CPU (milliseconds)
Explain the resource sharing options in Process creation
- Parents and child process share all resources
- Children share a subset of parents resources
- no resources are shared
Explain the execution options with parents and child processes
- parents and children execute concurrently
- parents wait for children to terminate
Explain Process Termination
Process executes last statement and aks the OS to delete it. Process resources are deallocated by OS. Parent may terminate execution of child processes (if all children are terminated when the parent is it is called cascading termination)
Explain the Two models of Inter-process communication
- Shared memory
- Memory passing - processes use send(message) and receive(message) to share info.
What is the difference between indirect and direct communication in regards to processes?
Direct - processes name each other explicitly (send(P, message)), a link is established automatically and is associated with one pair of communicating processes (uni bidirectional)
Indirect - messages are directed and received from mailboxes, with each one having a unique id. processes can only communicate if they share a mailbox. a link can be associated with many processes and each pair of processes can share several links
Explain How Synchronization works in IPC
message passed may be blocking or non-blocking. Blocking is considered synchronous
blocking send has the sender send a request to the receiver and block until it receives an acknowledgement, non-blocking is asynchronous and has the sender send the message and continue operation
blocking receive has the receiver wait idle until a send message is received. non-blocking has the receiver receive a valid message or null if there is no message yet
Explain and list the different types of buffering attached to process links
Queue of messages attached to the link
1. zero capacity - 0 messages can be held and sender must wait for receiver
2. Bounded capacity - finite length of n messages (sender must wait if link is full)
3. unbounded capacity - infinite length, sender never waits just sends
What is an Ordinary Pipe
Unidirectional relationships between processes where one end writes and sends what is written to the other end where the other process reads
requires parent-child relationship
Explain the difference between named pipes and ordinary pipes
named pipes are like ordinary pipes but bidirectional and they do not require a parent child relationship
Explain the difference between threads and Processes
A process is a program being executed via a thread with code, data and other resources. it owns memory, files and resources
A thread is a way of making a distinction between the resources and the executing process. A process is made up of threads so there can be multiple threads which share memory code and files
Multicore programming
multi-core - multiple cores are placed on a single chip where each core appears as a separate CPU
Explain what Concurrency is?
Supports more than one task making progress
With 1 processor a scheduler provides concurrency
Explain the different types of parallelism
Parallelism: implies a system can perform more than one task simultaneously
Data parallelism - distributes subsets of the same data across multiple computing cores and performing same operation on each core
Task parallelism - involves distributing data but not tasks (threads) across multiple computing cores - each thread performs a unique operation
What is the difference between user and kernel threads
User threads - supported above kernel, kernel is unaware of them
Kernel threads - supported and managed directly by the OS
What are the three ways of establishing a relationship between user and kernel threads?
Many to one: many user to 1 kernel
many to many: many user to many kernel
one to one: 1 kernel to 1 user
Explain what signal handling entails with respect to threads
Signal handler processes signals which notify a process when an event has occurs
signal is generated -> signal is delivered to process -> signal is handled by default handler or user defined one