Operating System Flashcards
operating system services function
provides functions that are helpful to the user
user interface
command-line, GUI, batch
what is a Operating System
A program that acts as an intermediary between the user and the computer
functions of operating system
resource allocator
control program
goals of operating system
Execute programs and solve problems more easily
Make the computer system convenient for the user
Use computer hardware efficiently
Components of computer system
- Hardware
- Operating system
- Application program
- User
Computer-System Operation
I/O devices and the CPU can execute concurrently
Each device controller is in charge of a certain device type
Each device has a local buffer
CPU moves data from/to main memory to/from local buffer
functions of interrupt
- Interrupt transfers control to the interrupt service routine through the interrupt vector
- Interrupt architecture saves the address of the interrupted instruction
Direct Memory Access Structure
Used for high-speed I/O devices able to transmit information at close to memory speeds
Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention
Only one interrupt is generated per block, rather than the one interrupt per byte
Interrupt handling
- The operating system preserves the state of the CPU by storing registers and the program counter
- Separate segments of code determine what action should be taken for each type of interrupt
why is the O/S called a resource allocator
o Manages all resources
o Decides between conflicting requests for efficient and fair resource use
why is O/S known to control programs?
o Controls execution of programs to prevent errors and improper use of the computer
o Management of the operation and control of I/O devices
Storage Structure
- Main memory (large storage media that the CPU can access directly)
- Secondary memory (acts as extension of main memory that provides large non-volatile storage capacity)
- Magnetic disk (rigid metal covered with magnetic recording material)
Storage-Device Hierarchy
register > Cache > Main memory > Electronic disk > Magnetic disk > Optical disk > Magnetic tapes
Advantages of Multiprocessor systems
Increased throughput
Economy of scale
Increase reliability
Timesharing (multitasking)
logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing
Types of Multiprocessor System
- Asymmetric multiprocessing - Each processor performs a task
- Symmetric multiprocessing - Each processor performs all task
Types of Cluster System
- Asymmetric clustering - has one machine in hot-standby mode
- Symmetric clustering - has multiple nodes running applications and monitoring each other
activities of process management
Creating and deleting user and system processes
Suspending and resuming processes
Providing mechanisms for process synchronization
Providing mechanisms for process communication
Providing mechanisms for deadlock handling
memory management activities
- Keeping track of which parts of memory are currently being used and by whom
- Deciding which part of processes and data to move into and out of memory
- Allocating and deallocating memory space as needed
Storage management activities
- Creating and deleting files and directories
- Primitives to manipulate files and dirs
- Mapping files onto secondary storage
- Backup files onto stable storage media
List the services provided by an O/S
- Program execution - The system must be able to load a program into memory and to run that program, end execution, either normally or abnormally
- I/O operations - A running program may require I/O, which may involve a file or an I/O device
- File-system manipulation - programs need to read and write files and directories, create and delete them, search them, list file Information, permission management.
- Communication - Processes may exchange information, on the same computer or between computers over a network
- Error detection - OS needs to be constantly aware of possible errors
- Resource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated to each of them
- Accounting - To keep track of which users use how much and what kinds of computer resources, either for billing purposes or for statistical record keeping.
- Protection and security - Protection involves ensuring that all access to system resources is controlled. Security of the system from outsiders requires user authentication, and extends to defending external I/O devices from invalid access attempts
Describe The Functions of Command Line Interface
- allows direct command entry
- Primarily fetches a command from user and executes it
GUI
- Usually mouse, keyboard, and monitor
- Icons represent files, programs, actions, etc
- Various mouse buttons over objects in the interface cause various actions
System calls
- Provides an interface to the services provided by the OS
- Typically written in a high-level language (C or C++)
- Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use
System Call Implementation
- A number is associated with each system call
- System-call interface maintains a table indexed according to these numbers
- The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values
API - System Call - OS Relationship
The use of APIs provides for greater program portability between different systems. The API makes the appropriate system calls through the system call interface, using a table lookup to access specific numbered system calls.
Methods of System Call Parameter Passing
Simplest: pass the parameters in registers
Parameters stored in a table, in memory, and address of block passed as a parameter in a register
Parameters placed, onto the stack by the program and popped off the stack by the operating system
types of system calls
Process control
File management
Device management
Information maintenance
Communications
Protection
System programs provide?
a convenient environment for program development and execution
system program can be divided into
File manipulation
Status information
File modification
Programming language support
Program loading and execution
Communications
Application programs
describe the monolithic structure of kernel organization
- Consists of everything below the system-call interface and above the physical hardware
describe the layered approach
The operating system is divided into a number of layers, each built on top of lower layers and relies solely on the services provided by the next lower layer. The bottom layer is the hardware; the highest is the user interface
describe the modular approach
- Uses an object-oriented approach, with a relatively small core kernel and a set of module which can be linked in dynamically.
- Each core component is separate
- Each talks to the others over known interfaces
- Each is loadable as needed within the kernel
Modular vs layered
Modules are similar to layers in that each subsystem has clearly defined tasks and interfaces, but any module is free to contact any other module, eliminating the problems of going through multiple intermediary layers
The kernel is relatively small in this architecture, similar to microkernels, but the kernel does not have to implement message passing since modules are free to contact each other directly.
Benefits of Microkernel System Structure
adding a new service does not require modifying the kernel
b. it is more secure as more operations are done in user mode than in kernel mode
c. a simpler kernel design and functionality typically results in a more reliable operating system
Solaris modular approach consists of?
- scheduling classes
- file system
- loadable system calls
- executable formats
- STREAMS modules
- miscellaneous modules
- device and bus drivers
describe Virtual machine
A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware
A virtual machine provides an interface identical to the underlying hardware
The operating system host creates the illusion that a process has its own processor and virtual memory
Each guest is provided with a virtual copy of underlying computer
List the four steps that are necessary to run a program on a completely dedicated machine—a
computer that is running only that program
reserve machine time.
Manually load program into memory
load starting address and begin execution
monitor and control execution of program from console
How does the distinction between kernel mode and user mode function as a rudimentary form
of protection (security) system?
- certain instructions could be executed only when the CPU is in kernel mode
- hardware devices could be accessed only when the program is in kernel mode
- control over when interrupts could be enabled or disabled is possible only when the CPU is in kernel mode
- CPU has limited capability when executing in user mode, thereby enforcing protection of critical resources
What is the purpose of interrupts?
An interrupt can be used to signal the completion of an I/O to obviate the need for device polling
A trap can be used to call operating system routines or to catch arithmetic errors
What are the differences between a trap and an interrupt?
An interrupt can be used to signal the completion of an I/O to obviate the need for device polling
An interrupt is a hardware-generated change of flow within the system
A trap can be used to call operating system routines or to catch arithmetic errors
A trap is a software-generated interrupt
What is the purpose of traps?
A trap can be used to call operating system routines or to catch arithmetic errors
Propose of CPU Scheduler
Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them
when does CPU scheduling decisions take place
when a process:
1. Switches from running to waiting state
2. Switches from running to ready state
3. Switches from waiting to ready
4. Terminates
Describe Context Switch
- When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process via a context switch, – involves saving and restoring all of the registers, program counter(s), and process control blocks
what Are The Scheduling Algorithm Optimization Criteria?
Max CPU utilization
Max throughput
Min turnaround time
Min waiting time
Min response time
list the process in memory
program counter
stack
data section
Text
heap
List the Process States
- New: The process is being created.
- Running: Instructions are being executed.
- Waiting: The process is waiting for some event to occur.
- Ready: The process is waiting to be assigned to a process.
- Terminated: The process has finished execution.
List Out Process Control Block (PCB)
Process State
Process ID, and parent process ID.
CPU registers and Program Counter
CPU-Scheduling information
Memory-Management information
Accounting information
I/O Status information
State Objectives of Process Scheduling Queues
- to keep the CPU busy at all times
- to deliver “acceptable” response times for all programs, particularly for interactive ones.
- The process scheduler must meet these objectives by implementing suitable policies for swapping processes in and out of the CPU.
state the Process Scheduling Queues
o Job queue – set of all processes in the system
o Ready queue – set of all processes residing in main memory, ready and waiting to execute
o Device queues – set of processes waiting for an I/O device
list out the Schedulers
- Long-term scheduler: selects which processes should be brought into the ready queue
- Medium-term scheduler: When system loads get high, this scheduler will swap one or more processes out of the ready queue system for a few seconds, in order to allow smaller faster jobs to finish up quickly and clear the system
- Short-term scheduler: selects which process that in ready queue should be executed next and allocates CPU
Describe Process Creation
- Parent process creates children processes through appropriate system calls, such as fork or spawn, which, in turn, create other processes, forming a tree of processes
- Process is identified and managed via a process identifier (PID). The parent PID (PPID) is also stored for each process.