C191-Terms-Chapter-1-2 Flashcards
Operating System (OS)
The software runs on the bare hardware of a computer and provides essential support for users to develop and use applications in the most efficient and safe manner.
An OS provides an environment for the execution of programs. It makes certain services available to programs and to the users of those programs.
What are the goals of the OS?
Execute user programs and make solving user problems easier.
Make the computer system convenient to use.
Use the computer hardware in an efficient manner.
What are the four components of a computer system?
- Hardware (lowest level) - provides basic computing resources such as CPU, memory, and I/O devices.
- OS - controls and coordinates the use of the hardware among applications and users.
- Application Programs - define the ways in which the system resources are used to solve the computing problems of the users. These include Word processors, compilers, web browsers, database systems, and video games.
- Users - people, machines, and other computers.
The OS as a resource manager
- Manages all resources.
- Decide between conflicting requests for efficient and fair resource use.
One of the main tasks of an OS is to optimize the use of all computational resources to ensure good overall performance, while satisfying the requirements of specific applications, including guaranteeing acceptable response times for interactive processes, meeting deadlines of time-critical tasks, and allowing safe communication among different tasks.
The OS is a control program
The OS controls the execution of programs to prevent errors and improper use of the computer.
Bootstrap Program
It’s loaded at power-up or reboot.
- First program to run when the computer
powers on, which then loads the OS.
- Typically stored in ROM or EPROM, generally known as firmware.
- Initializes all aspects of the system.
- Loads the OS kernel and starts execution.
Computer-system operation
One or more CPUs and device controllers connect through a common bus providing access to shared memory.
Concurrent execution of CPUs and devices competing for memory cycles.
The CPU and device controllers can run concurrently and compete for memory cycles.
I/O devices and the CPU can execute concurrently.
Each device controller is in charge of a specific device type.
Each device controller has a local buffer.
The CPU moves data from/to main memory to/from local buffers.
I/O is from the device to the local buffer of the controller.
The device controller informs the CPU that it has finished its operation by causing an
interrupt.
Interrupts
An interrupt is an event that diverts the current execution of a program to a predefined location in the kernel in order to respond to an event.
An interrupt is triggered by a hardware signal sent to the CPU from an external device.
The two most common uses of interrupts are as follows:
- Signal to the OS for the completion of an I/O operation. The interrupt is generated by the I/O device.
- Implement time-sharing by periodically switching the CPU among multiple concurrent computations. The interrupt is generated by a countdown timer.
Common Functions of Interrupts
Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines.
Interrupt architecture must save the address of the interrupted instruction.
Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt.
A trap is a software-generated interrupt caused either by an error or a user request.
An OS is interrupt driven.
Interrupt Handler
A kernel function invoked whenever an interrupt occurs determines the cause of the interrupt and invokes the appropriate kernel function to provide the response.
When the kernel function completes the requested service, the state of the interrupted computation is restored and control is returned to the instruction following the interrupt.
The handling of an interrupt is thus completely transparent to the interrupted computation and provides an immediate response to asynchronous events.
Interrupt Handling
The OS preserves the state of the CPU by storing registers and the program counter.
Determines which type of interrupt has occurred:
- Polling
- Vectored interrupt system
Separate segments of code determine what action should be taken for each type of interrupt.
I/O Structure
After I/O starts, control returns to the user program only upon I/O completion. This I/O method is called synchronous.
- Wait instruction idles the CPU until the next attempt.
- Wait loop (contention for memory access).
- At most one I/O request is outstanding at a time, no simultaneous I/O processing.
After I/O starts, control returns to the user program without waiting for I/O completion. This I/O method is called asynchronous.
- System call: request to the OS to allow the user (to do something) to wait for I/O completion.
- Device- status table: contains an entry for each I/O device indicating its type, address, and state.
- The OS indexes into the I/O device table to determine device status and to modify table entry to include interrupt.
I/O Storage
Main memory - the only large storage media that the CPU can access directly.
Secondary storage - an extension of the main memory that provides large nonvolatile storage capacity.
Magnetic disks - rigid metal or glass platters covered with magnetic recording material.
- Disk surface is logically divided into tracks, which are subdivided into sectors.
- The disk controller determines the logical interaction between the device and the computer.
CPU
Hardware capabilities - machine instructions perform operations on contents of registers and memory locations.
User needs - The user thinks in terms of
arrays, lists, and other high-level data structures accessed and
manipulated by corresponding high-level operations.
Main memory
Hardware capabilities - physical memory is a linear sequence of addressable bytes or words that hold programs and data.
User needs - the user must manage a heterogeneous collection of entities of various types and sizes, including source and executable programs, library functions, and dynamically allocated data structures, each accessed by different operations.
Secondary storage
Hardware capabilities - disks and other secondary storage devices are multi-dimensional structures, which require complex sequences of low-level operations to store and access data organized in discrete blocks.
User needs - the user needs to access and
manipulate programs and data sets of various sizes as individual named entities without any knowledge of the disk organization.
I/O devices
Hardware capabilities - I/O devices are operated by reading and writing registers of the device controllers.
User needs - the user needs simple, uniform interfaces to access different devices without detailed knowledge of the access and communication protocols.
Abstraction
Abstraction is the act of removing unimportant details or attributes of objects in order to construct more general and less complex objects.
OSs make extensive use of abstraction by creating hierarchies of objects where multiple operations at one level are
combined into a single operation at a higher level, thus hiding the details of the implementation and making the operation easier to use.
Virtualization
Virtualization is the act of creating the illusion of having one or more objects with more desirable characteristics than the real object.
OSs rely on virtualization to create virtual CPUs, memory, I/O devices, and other system components that facilitate the work of programmers and users.
Abstraction and Virtualization
The concepts of abstraction and virtualization are closely related. Abstraction emphasizes combining simpler objects or operations to create objects with expanded functionality.
Virtualization may use abstraction but emphasizes diversifi cation and replication by creating illusions of objects with more favorable characteristics.
An OS is thus an extended machine, which provides e fficient high-level functions and virtual entities that liberate the programmer and the user from having to understand details of memory, disk, I/O management, and other internal processes.
Multiprogramming
A technique that keeps several programs active in memory and switches execution among the different programs to maximize the use of the CPU and other resources.
Whenever a program enters an I/O-bound phase where little CPU time is needed, other programs can resume and utilize the CPU in the meantime.
Similarly, whenever a device completes an operation, the OS activates computations that can utilize the now available device.
Time-sharing (multitasking)
An extension of multiprogramming where the CPU is switched periodically among all active computations to guarantee acceptable response times to each user.
Time-sharing employs the concept of virtualization by creating the illusion of having a separate virtual CPU for each computation.
Kernel
The min set of functions that is necessary to manage the system resources safely and efficiently.
The kernel provides the most essential services for memory and device management, creating and managing units of computation, and communication among the different concurrent activities within the system.
The functionality of the kernel is extended by a set of libraries, which use kernel functions to implement higher-level system functions.
Additional libraries provide a wide range of other services to the users by supporting abstractions above the system calls. Applications and system software, including editors, compilers, and interpreters, form the highest layer of software.
Depending on the type of application or service, software at the top level may use library services, issue system calls, or invoke kernel services directly.
Privileged instruction
Performs critical operations that access I/O devices and the CPU’s status and control registers. Thus only the OS kernel is allowed to execute privileged instructions.