Operating System Objectives and Functions

advertisement
CmSc 125
Operating Systems
1. Operating system objectives and functions
What is an operating system? Some definitions:
A program that is executed by the processor that frequently relinquishes control and must
depend on the processor to regain control.
A program that mediates between application programs and the hardware
A set of procedures that enable a group of people to use a computer system.
A program that controls the execution of application programs
An interface between applications and hardware
The common idea behind these definitions:
Operating systems control and support the usage of computer systems.
Concepts to be discussed:
Usage
Computer system
Control
Support
a. usage
users of a computer system:
programs - use memory, use CPU time, use I/O devices
human users
programmers - use program development tools such as debuggers, editors
end users - use application programs, e.g. Internet explorer
b. computer system = hardware + software
OS is a part of the computer software, it is a program. It is a very special program, that is
the first to be executed when the computer is switched on, and is supposed to control and
support the execution of other programs and the overall usage of the computer system.
c. control
The operating system controls the usage of the computer resources - hardware devices
and software utilities. We can think of an operating system as a Resource Manager. Here
are some of the resources managed by the OS:
Processors,
Main memory,
Secondary Memory,
Peripheral devices,
1
Information.
d. support
The operating system provides a number of services to assist the users of the computer
system:
For the programmers:
Utilities - debuggers, editors, file management, etc.
For the end users - provides the interface to the application programs
For programs - loads instructions and data into memory, prepares I/O devises for
usage, handles interrupts and error conditions.
The hierarchical view of the computer system illustrates how the operating system interacts with
the users of the computer system:
Main Objectives in OS design:
Convenience – makes computer user friendly.
2
Efficiency- allows computer to use resources efficiently.
Ability to evolve- constructed in a way to permit effective development, testing and
introduction of new functions without interfering with service.
2. Evolution of Operating Systems
Serial Processing - 1940’s – 1950’s programmer interacted directly with hardware. No
operating system.
problems
Scheduling - users sign up for machine time. Wasted computing time
Setup Time- Setup included loading the compiler, source program, saving
compiled program, and loading and linking. If an error occurred - start over.
Simple Batch Systems
Improve the utilization of computers.
Jobs were submitted on cards or tape to an operator who batches jobs together
sequentially. The program that controls the execution of the jobs was called monitor - a simple
version of an operating system. The interface to the monitor was accomplished through Job
Control Language (JCL). For example, a JCL request could be to run the compiler for a
particular programming language, then to link and load the program, then to run the user
program.
Hardware features:
Memory protection: do not allow the memory area containing the monitor to be altered
Timer: prevents a job from monopolizing the system
Problems:
Bad utilization of CPU time - the processor stays idle while I/O devices are in use.
Multiprogrammed Batch Systems
More than one program resides in the main memory. While a program A uses an I/O device the
processor does not stay idle, instead it runs another program B.
3
New features:
Memory management - to have several jobs ready to run, they must be kept in main
memory
Job scheduling - the processor must decide which program to run.
Time-Sharing Systems
Multiprogramming systems : several programs use the computer system
Time-sharing systems : several (human) users use the computer system interactively.
Characteristics:
 Using multiprogramming to handle multiple interactive jobs
 Processor’s time is shared among multiple users
 Multiple users simultaneously access the system through terminals
Batch Multiprogramming
Time Sharing
Principal objective
Maximize processor use
Minimize response time
Source of directives to
operating system
Job control language commands
provided with the job
Commands entered at the
terminal
4
Time sharing is multiprogramming. The key differences between time-sharing systems and batch
multiprogramming systems are given in the table above.
3. Major Achievements
Five major theoretical advances in development
Processes
Memory Management
Information protection and security
Scheduling and resource management
System structure
3.1. Processes
What is a process?
A program in execution
An instance of a program running on a computer
The entity that can be assigned to and executed on a processor
A unit of activity characterized by a single sequential thread of execution, a current state,
and an associated set of system resources
Difficulties with designing system software:
Improper Synchronization: results from an improper design of a signaling mechanism can
result in duplicate signals, or lost signals.
Failed Mutual Exclusion: two programs attempt to modify shared piece of data.
Nondeterministic program operation: a program may change the contents of memory used by
another program, and in this way affect unpredictably the operation of the other program.
Deadlock: each program is waiting for the other program to release its resource
Solution to these problems: use the concept of a process that consists of
An executable program
Associated data needed by the program
Execution context of the program: All information the operating system needs to manage
the process
5
3.2. Memory Management
Responsibilities of OS
Process isolation - prevent independent processes from interfering with each other
Automatic allocation and management - transparent to the programmer
Support of modular programming
Protection and access control
Long-Term Storage
The above requirements are satisfied by means of virtual memory and file system facilities
Virtual memory and paging
Allows programmers to address memory from a logical point of view
Allows process to be comprised of a number of fixed-size blocks, called pages
6
Virtual address is a page number and an offset within the page
Each page may be located any where in main memory
Dynamic mapping between the virtual address used in the program and the real address in main
memory
File system
Implements long-term store
Information stored in named objects called files
3.3. Information protection and security
Access Control - regulates user access to the whole system, subsystems, and data
Information flow control- regulates the flow of data within the system and its delivery to users.
Certification- relates to proving that access and flow control mechanisms perform according to
their specifications and enforce desired protection and security policies.
3.4. Scheduling and resource management
Factors to be considered:
Fairness- give equal and fair access to all jobs of the same class
Differential Responsiveness- discriminate between different classes of jobs.
Efficiency- maximize throughput, minimize response time and accommodate as many users as
possible.
The major elements of the operating system involved in scheduling and resource management in
a multiprogramming environment are depicted in Figure 2.11
I/O queues: processes waiting for I/O devices ( a queue is associated with each I/O
device)
Short-term queue: a list of processes whose execution has been started. They reside in
main memory. Round-robin technique: give each process some time in turn.
Long-term queue: a list of new jobs waiting to be started.
How does it work?
Assume that a process is running. The following events transfer the control from the
process to the OS
Service call from the process - the process explicitly invokes some of the OS
services, e.g. I/O operations.
Interrupt from the process, e.g. exception handling
Timer interrupt - the time slice for the process is over
I/O interrupt - an I/O device reports its status to the OS.
In each case the corresponding handler is invoked, and then the short-tem scheduler picks
up the next process to be run.
7
3.5. System structure
Guidelines:
Modular software
Well-defined interfaces between modules, as simple as possible
Hierarchical layered structure
Each level:
- performs a related subset of functions
- relies on the next lower level to perform more-primitive functions and to conceal the
details of those functions
- provides services to the next higher level
8
4. Characteristics of Modern Operating Systems
Microkernel architecture-assigns only a few essential functions to the kernel, including address
spaces, interprocess communication, and basic scheduling.
Multithreading- the process is divided into threads that can run simultaneously
Thread- dispatchable unit of work. It includes a processor context program counter and stack
pointer and its own data storage for the stack. It executes sequentially and is interruptable
Process- collection of one or more threads and associated system resources.
Symmetric multiprocessing- standalone computer with multiple processors that share the same
memory and I/O facilities connected by a communication bus. All processors can perform the
same functions
Distributed operating systems - provide the illusion of a single main memory and single
secondary memory space. Used for distributed file system
Object-oriented design - used for adding modular extensions to a small kernel.
Enables programmers to customize an operating system without disrupting system integrity
Exam-like questions:
1. Compare batch multiprogramming systems and time-sharing systems. Discuss their
similarities and differences.
2. How is a process defined?
3. Discuss the difficulties in early OS that motivated the use of processes in OS design.
4. Describe briefly virtual memory and paging techniques for memory management.
5. Describe briefly how the resource scheduling works.
6. List and describe briefly four of the characteristics of modern operating systems
9
Download