Operating Systems Concepts Chapters 1-4
Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing
Resource Allocation, Accounting, Protection, and Security
A modern general-purpose computer system consists of what?
one or more CPUs and a number of device controllers connected through a common bus that provides access to shared memory
User goals
operating system should be convenient to use, easy to learn, reliable, safe, and fast
System goals
operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient
The parent process may wait for termination of a child process by using the ______ system call.
wait()
When does a program become a process?
when an executable file is loaded into memory
Direct Memory Access (DMA)
After setting up buffers, pointers, and counters for the I/O device, the device controller transfers an entire block of data directly to or from its own buffer storage to memory, with no intervention by the CPU. Only one interrupt is generated per block, to tell the device driver that the operation has completed, rather than the one interrupt per byte generated for low-speed devices. While the device controller is performing these operations, the CPU is available to accomplish other work.
I/O-bound process
spends more time doing I/O than computations, many short CPU bursts
Process
A program in execution
What is an Operating System?
A program that acts as an intermediary between a user of a computer and the computer hardware
Shared memory
A region of memory that is shared by cooperating processes is established. Processes can then exchange information by reading and writing to data to the shared region.
Timesharing
CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing
fault tolerant Systems
Can suffer a failure of any single component and still continue operation
When a process creates a new process, there are also two address-space possibilities for the new process:
Child duplicate of parent; Child has a new program loaded into it
Reasons a parent might end a child process:
Child has exceeded allocated resources; Task assigned to child is no longer required; The parent is exiting and the operating systems does not allow a child to continue if its parent terminates
Two ways for users to interface with the operating system:
Command-line interface, or command, Graphical user interface (GUI)
Message passing
Communication takes place by means of messages exchanged between the cooperating processes
Interrupt Vector
Contains the addresses of all the interrupt service routines
An operating system is a control program
Controls execution of programs to prevent errors and improper use of computer
Asymmetric Multiprocessing
Each processor is assigned a specific task. A boss processor controls the system; the other processors either look to the boss for instruction or have predefined tasks.
Symmetric Multiprocessing (SMP)
Each processor performs all tasks within the operating system. Processors are peers.
Benefits of Microkernel System Structure
Easier to extend a microkernel, Easier to port the operating system to new architectures, More reliable (less code is running in kernel mode), More secure
Operating system goals:
Execute user programs and make solving user problems easier, Make the computer system convenient to use, Use the computer hardware in an efficient manner
System Program Categories
File management, Status information, File modification, Programming language support, Program loading and execution, Communications, Background services
Multiprocessors systems (parallel systems, multicore systems)
Have two or more processors in close communication, sharing the computer bus and sometimes the clock, memory and peripheral devices
Resource Utilization
How various hardware and software resources are shared
Cascading Termination
If a process terminates, then all its children must also be terminated
Where is a new process put initially?
In the ready queue
Advantages of multiprocessor systems
Increased throughput (more processors = more work done in less time), Economy of scale (cost less than multiple single-processor systems, because they share peripherals mass storage, and power supplies), Increased reliability (failure of one processor will not halt the system, only slow it down)
Multiprogramming
Increases CPU utilization by organizing jobs (code and data) so that the CPU always has one to execute
Caching
Information in use copied from slower to faster storage temporarily
Reasons for cooperating processes:
Information sharing, Computation speedup, Modularity, Convenience
Bootstrap program
Initializes all aspects of the system, loads OS kernel and starts execution.
Running Process
Instructions are being executed
Clustered Systems
Like multiprocessor systems, but are composed of two or more systems joined together
Privileged instructions
Machine instructions that may cause harm and can only be executed in kernel mode
An operating system is a resource allocator
Manages all resources and decides between conflicting requests for fair and efficient resource use
What is the difference between policy and mechanism?
Mechanisms determine how to do something, policies decide what will be done
Microkernel System Structure
Moves as much from the kernel into user space
The differences between multiprocessor system and clustered system
Multiprocessor systems are closely coupled- multiple processors share the same memory. Clustered systems are loosely coupled- the multiple clusters each have their own memory but share the same storage
Process states
New, Running, Waiting, Ready, Terminated
Asymmetric Clustering
One machine is hot-standby mode while the other is running the applications. The hot-standby host machine does nothing but monitor the active server. If that server fails, the hot-standby host becomes the active server.
When a process creates a new process, two possibilities for execution exist
Parent and children execute concurrently; Parent waits until children terminate
Three resource sharing options for parent and children processes
Parent and children share all resources; Children share subset of parent's resources; Parent and child share no resources
Process Termination
Process executes last statement and then asks the operating system to delete it using the exit() system call.
The process control block contains many pieces of information associated with a specific process:
Process state, program counter, CPU registers, CPU-scheduling information, Accounting information, I/O status information
System Calls
Provide an interface to the services made available by an operating system
Where is the bootstrap program stored?
ROM or EEPROM
System-call Interface
Serves as the link to system calls made available by the operating system
Device Queues
Set of processes waiting for an I/O device. Each device has its own device queue
Two models of interprocess communication
Shared memory; message passing
Various ways to structure and operating system
Simple structure (MS-DOS), More complex (UNIX), Layered (an abstraction), Microkernel (Mach)
Application programming interface (API)
Specifies a set of functions that are available to an application programmer, including the parameter that are passed to each function and the return values the programmer can expect
Memory Controller
Synchronizes access to the memory to ensure orderly access to shared memory
Stack
Temporary data
What is included in a process?
Text section, Current activity, Stack, Data section, Heap
Graceful Degradation
The ability to continue providing service proportional to the level of surviving hardware
Two approaches to implementing a command interpreter
The command interpreter itself contains the code to execute the command or it implements most commands through system programs (The command interpreter does not understand the command in any way; it merely uses the command to identify a file to be loaded into memory and executed)
I/O operation
The device driver loads the appropriate registers within the device controller. The device controller, in turn, examines the contents of these registers to determine what action to take (such as "read a character from the keyboard "). The controller starts the transfer of data from the device to its local buffer. Once the transfer of data is complete, the device controller informs the device driver via an interrupt that it has finished its operation. The device driver then returns control to the operating system, possibly returning the data or a pointer to the data if the operation was a read.
Loadable Kernel Modules
The kernel has a set of core components and links in additional services via modules, either at boot time or during run time
Kernel
The one program running at all times on the computer
Layered Approach
The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface.
Once a process is allocated the CPU and is executing, one of several events could occur:
The process could issue an I/O request and then be placed in an I/O queue. The process could create a new child process and wait for the child's termination. The process could be removed forcibly from the CPU, as a result of an interrupt, and be put back in the ready queue.
Waiting process
The process is waiting for some event to occur
Ready Process
The process is waiting to be assigned to a processor
Text Section
The program code
Current activity
The value of the program counter and the contents of the processor registers
Symmetric Clustering
Two or more hosts are running applications and monitoring each other
Device Driver
Understands the device controller and provides the rest of the operating system with a uniform interface to the device
One set of operating-system services provides functions that are helpful to the user:
User Interface, Program Execution, I/O Operations, File-System Manipulation, Communications, Error Detection
What are the two separate modes of operation?
User mode (1) and kernel mode (0)
Context Switch
a state save of the current state of the CPU, be it in kernel or user mode, and then a state restore to resume operations
Parent may terminate the execution of children processes using the _______ system call
abort()
Dual-mode operation
allows OS to protect itself and other system components
Cooperating process
can affect or be affected by the execution of another process
Independent process
cannot affect or be affected by the execution of another process
Heap
contains memory dynamically allocated during run-time
fork() system call
creates new process
Application Programs
define the ways in which the system resources are used to solve the computing problems of the users (Word processors, compilers, web browsers, database systems, video games)
parallelization
divides a program into separate components that run in parallel on individual computers in the cluster
What do users want from an operating system?
ease of use, and performance
Interrupt Service Routine
examines the interrupt and determines how to handle it
Data section
global variables
Three general methods used to pass parameters to the OS
pass the parameters in registers, Parameters stored in a block, or table in memory, and address of block passed as a parameter in a register, Parameters placed, or pushed, 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
Hardware
provides basic computing resources (CPU, memory, I/O devices)
Device controller
responsible for moving the data between the peripheral devices that it controls and its local buffer storage
Process scheduler
selects among available processes for next execution on CPU
Job Queue
set of all processes in the system
Ready Queue
set of all processes residing in main memory, ready and waiting to execute
On systems with multiple command interpreters to choose from, the interpreters are known as __________.
shells
Interrupt
signals the occurrence of an event from either hardware or sofware
Trap or Exception
software-generated interrupt caused either by an error or a user request
CPU-bound process
spends more time doing computations; few very long CPU bursts
When an interrupt occurs, the system needs to save...
the current context of the process running on the CPU so that it can restore that context when its processing is done
An interrupt transfer control to ___________________.
the interrupt service routine
What is the main function of the command interpreter
to get and execute the next user-specified command
What does the Operating System control and coordinate?
use of hardware among various applications and users
exec() system call
used after a fork() to replace the process' memory space with a new program