Osunit 1 Part 1
Osunit 1 Part 1
Operating System
An operating system is a program that controls the execution of application programs and acts
as an interface between the user of a computer and the computer hardware.
A more common definition is that the operating system is the one program running at all times
on the computer (usually called the kernel), with all else being application programs.
An operating system is concerned with the allocation of resources and services, such as
memory, processors, devices, and information. The operating system correspondingly includes
programs to manage these resources, such as a traffic controller, a scheduler, a memory
management module, I/O programs, and a file system.
processors, spreadsheets,compilers, and web browsers—define the ways in which these resources
are used to solve users’ computing problems. The operating system controls the
hardware and coordinates its use among the various application programs for the various users.
We can also view a computer system as consisting of hardware, software, and data. The operating
system provides the means for proper use of these resources in the operation of the computer
system.
User View
The user’s view of the computer varies according to the interface being used. Many computer users
sit with a laptop or in front of a PC consisting of a monitor, keyboard, and mouse. Such a system is
designed for one user to monopolize its resources. The goal is to maximize the work (or play) that
the user is performing. In this case, the operating system is designed mostly for ease of use, with
some attention paid to performance and security and none paid to resource utilization —how
various hardware and software resources are shared.
Increasingly, many users interact with mobile devices such as smartphones and tablets—devices
that are replacing desktop and laptop computer systems for some users. These devices are typically
connected to networks through cellular or other wireless technologies. The user interface for mobile
computers generally features a touch screen, where the user interacts with the system by pressing
and swiping fingers across the screen rather than using a physical keyboard and mouse. Many
mobile devices also allow users to interact througha voice recognition interface, such as Apple’s
Siri.
Some computers have little or no user view. For example, embedded computers in home devices
and automobiles may have numeric keypads and may turn indicator lights on or off to show status,
but they and their operating systems and applications are designed primarily to run without user
intervention.
System View
From the computer’s point of view, the operating system is the program most intimately involved
with the hardware. In this context, we can view an operating system as a resource allocator. A
computer system has many resources that may be required to solve a problem: CPU time, memory
space, storage space, I/O devices, and so on. The operating system acts as the manager of these
resources. Facing numerous and possibly conflicting requests for resources, the operating system
must decide how to allocate them to specific programs and users so that it can operate the computer
system efficiently and fairly.
A slightly different view of an operating system emphasizes the need to control the various I/O
devices and user programs. An operating system is a control program. A control program manages
the execution of user programs to prevent errors and improper use of the computer. It is especially
concerned with the operation and control of I/O devices.
Computer-System Operation
A modern general-purpose computer system consists of one or more CPUs and a number of device
controllers connected through a common bus that provides access to shared memory (Figure 1.2).
Each device controller is in charge of a specific type of device (for example, disk drives, audio
devices, and video displays). The CPU and the device controllers can execute concurrently,
competing for memory cycles. To ensure orderly access to the shared memory, a memory controller
is provided whose function is to synchronize access to the memory.
For a computer to start running-for instance, when it is powered up or rebooted-it needs to
have an initial program to run. This initial program, or bootstrap program, tends to be simple.
Typically, it is stored in read-only memory (ROM) or electrically erasable programmable read-only
memory (EEPROM), known by the general term firmware, within the computer hardware. It
initializes all aspects of the system, from CPU registers to device
controllers to memory contents. The bootstrap program must know how to load the operating
system and to start executing that system. To accomplish this goal, the bootstrap program must
locate and load into memory the operating- system kernel. The operating system then starts
executing the first process, such as "init," and waits for some event to occur. The occurrence of an
event is usually signaled by an interrupt from either the hardware or the software. Hardware may
trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus.
Software may trigger an interrupt by executing a special operation called a system call (also called a
monitor call). When the CPU is interrupted, it stops what it is doing and immediately transfers
execution to a fixed location. The fixed location usually contains the starting address where the
service routine for the interrupt is located.
The interrupt service routine executes; on completion, the CPU resumes the interrupted
computation. A time line of this operation is shown in Figure 1.3. Interrupts are an important part of
a computer architecture. Each computer design has its own interrupt mechanism, but several
functions are common. The interrupt must transfer control to the appropriate interrupt service
routine.
Types of Operating Systems
Some of the most widely used types of Operating system are,
1. Simple Batch System
2. Multiprogramming Batch System
3. Multiprocessor System
4. Distributed Operating System
5. Realtime Operating System
Disadvantages:
In batch processing method, there is no direct interaction between user and the computer.
Priority to important process cannot be provided.
CPU can be idle.
Multiprogramming Batch Systems
Aims to maximize CPU utilization. The operating system picks and executes one job from
memory. If the picked job needs an I/O operation, the OS immediately switches to another job for
executing that job making the CPU busy always. If several jobs are ready for execution at the
same time, CPU Scheduling is carried out.
In multiprogrammed system, CPU is always busy executing one process or the other.
Time-Sharing Systems aim is to minimizing the response time.
Multiprocessor Systems
It has several processors that share a common physical memory. Execution of several tasks by
different processors concurrently. If possible, system divides task into many subtasks and then
these subtasks can be executed in parallel in different processors. Provides higher computing power
and speed.
All processors operate under single operating system. Enhanced performance is achieved
Increases the system's throughput without speeding up the execution of a single task.
Distributed Operating Systems
Many computers are inter-connected by communication networks.
Multiple systems are involved in communication.
User at one system can utilize the resources of other systems.
Load can be distributed among systems.
Fast processing.
COMPUTER-SYSTEM ARCHITECTURE
A computer system can be organized as follows, based on number of general-purpose
processors used.
Single-Processor Systems
Multiprocessor Systems
Clustered Systems
Single-Processor Systems: If there is only one general-purpose CPU, then the system is a
single-processor system. A single processor system, has one main CPU for executing a
general-purpose instruction set. It also has processors for specific purposes. Device-specific
processors like disk controller, graphics controllers and I/O processor for quick access to
data are special purpose processors. The operating system sends these processors
information about their next task and monitors their status. The overhead of the main CPU is
relieved by the arrangement.
Multiprocessor Systems: Multiprocessor systems are also known as parallel systems have
two or more processors in close communication, sharing the computer bus, the clock,
memory, and peripheral devices. Three important advantages of Multiprocessor systems are
Increased throughput - more work is carried out in less time.
Low cost – since it shares peripheral devices there is much reduction in cost. Also
processors share data stored on a disk thereby reducing requirement of storage media.
Increased reliability – since many processors are used, failure of a single processor
would only slow down the system rather than halting altogether thereby increasing
reliability of a computer system.
The two types of multiple-processor systems are:
Asymmetric multiprocessing - each processor is assigned a specific task. One main
processor controls the system; the other processors get instructions from it or have
predefined tasks. The main processor schedules and allocates work to the remaining
processors.
Symmetric multiprocessing (SMP) - each processor has its own set of registers and
cache memory but all processors share common physical memory. Each processor
performs all tasks within the operating system. All processors are main peers. Figure 1.2
illustrates a typical SMP architecture.
Latest CPU design includes multiple computing cores on a single chip. Such
multiprocessor systems are termed multicore. Recent development is blade servers in
which multiple processor boards, I/O boards, and networking boards are placed in the
same chassis. Each blade-processor board boots independently and runs its own
operating system.Fig.1.2 SMP Architecture
Clustered Systems: Multiple CPUs are gathered together. Composes of two or more
individual systems / nodes joined together. Each node may be a single processor system
or a multicore system. Clustered computers share storage and are closely linked via a
Local Area Network (LAN). Clustering provides high reliability - service will continue
even if one or more systems in the cluster fail. Clustering can be structured
asymmetrically or symmetrically.
In asymmetric clustering, one machine is in standby mode while the other is running the
applications. The standby host machine monitors the active server. If the server fails, the
standby host becomes the active server.
In symmetric clustering, two or more hosts are running applications and are monitoring
each other. This structure is obviously more efficient, as it uses all of the available
hardware. More than one application must be available to run.
One set of operating-system services provides functions that are helpful to the user
communications – Processes may exchange information, on the same computer or between
computers over a network Communications may be via shared memory or through message
passing (packets moved by the OS)
Error detection – OS needs to be constantly aware of possible errors May occur in the CPU
and memory hardware, in I/O devices, in user program For each type of error, OS should
take the appropriate action to ensure correct and consistent computing Debugging facilities
can greatly enhance the user’s and programmer’s abilities to efficiently use the system
Another set of OS functions exists for ensuring the efficient operation of the system itself
via resource Sharing
Resource allocation - When multiple users or multiple jobs running concurrently, resources
must be allocated to each of them
Many types of resources - Some (such as CPU cycles, main memory, and file storage) may
have special allocation code, others (such as I/O devices) may have general request and
release code
Accounting - To keep track of which users use how much and what kinds of computer
resources
Protection and security - The owners of information stored in a multiuser or networked
computer system may want to control use of that information, concurrent processes should
not interfere with each other Protection involves ensuring that all access to system resources
is controlled
Security of the system from outsiders requires user authentication, extends to defending
external I/O devices from invalid access attempts If a system is to be protected and secure,
precautions must be instituted throughout it. A chain is only as strong as its weakest link.
User Operating System Interface - CLI
Command Line Interface (CLI) or command interpreter allows direct command entry
Sometimes implemented in kernel, sometimes by systems program sometimes multiple
flavors implemented – shells
Primarily fetches a command from user and executes it
User Operating System Interface - GUI
User-friendly desktop metaphor interface
Usually mouse, keyboard, and monitor Icons
represent files, programs, actions, etc
Various mouse buttons over objects in the interface cause various actions (provide information,
options, execute function, open directory (known as a folder)
Invented at Xerox PARC
Many systems now include both CLI and GUI
interfaces Microsoft Windows is GUI with CLI
“command” shell
Apple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells
available Solaris is CLI with optional GUI interfaces (Java Desktop, KDE)
System Calls:
System calls provide the interface between a process & the OS. These are usually available in the
form of assembly language instruction. Some systems allow system calls to be made directly from a
high level language program like C, BCPL and PERL etc. systems calls occur in different ways
depending on the computer in use. System calls can be roughly grouped into 5 major categories.
1. Process Control:
•End, abort: A running program needs to be able to has its execution either normally (end) or
abnormally (abort).
•Load, execute:A process or job executing one program may want to load and executes
another program.
•Create Process, terminate process: There is a system call specifying for the purpose of
creating a new process or job (create process or submit job). We may want to terminate a job
or process that we created (terminates process, if we find that it is incorrect or no longer
needed).
•Get process attributes, set process attributes: If we create a new job or process we should
able to control its execution. This control requires the ability to determine & reset the
attributes of a job or processes (get process attributes, set process attributes).
•Wait time: After creating new jobs or processes, we may need to wait for them to finish their
execution (wait time).
•Wait event, signal event: We may wait for a specific event to occur (wait event). The jobs or
processes then signal when that event has occurred (signal event).
2. File Manipulation:
•Create file, delete file: We first need to be able to create & delete files. Both the system calls
require the name of the file & some of its attributes.
•Open file, close file: Once the file is created, we need to open it & use it. We close the file
when we are no longer using it.
•Read, write, reposition file: After opening, we may also read, write or reposition the file
(rewind or skip to the end of the file).
•Get file attributes, set file attributes: For either files or directories, we need to be able to
determine the values of various attributes & reset them if necessary. Two system calls get file
attribute & set file attributes are required for their purpose.
3. Device Management:
•Request device, release device: If there are multiple users of the system, we first request
the device. After we finished with the device, we must release it.
•Read, write, reposition: Once the device has been requested & allocated to us, we can read,
write & reposition the device.
4. Information maintenance:
•Get time or date, set time or date:Most systems have a system call to return the current
date & time or set the current date & time.
•Get system data, set system data: Other system calls may return information about the
system like number of current users, version number of OS, amount of free memory etc.
•Get process attributes, set process attributes: The OS keeps information about all its
processes & there are system calls to access this information.
An operating system is a program that controls the execution of application programs and acts
as an interface between the user of a computer and the computer hardware.
A more common definition is that the operating system is the one program running at all times
on the computer (usually called the kernel), with all else being application programs.
An operating system is concerned with the allocation of resources and services, such as
memory, processors, devices, and information. The operating system correspondingly includes
programs to manage these resources, such as a traffic controller, a scheduler, a memory
management module, I/O programs, and a file system.
A computer system can be divided roughly into four components: the hardware, the operating
system, the application programs, and the users (Figure 1.1).
The hardware—the central processing unit ( CPU ), the memory, and the input/output ( I/O )
devices—provides the basic computing resources for the system. The application programs—such
as word
processors, spreadsheets,compilers, and web browsers—define the ways in which these resources
are used to solve users’ computing problems. The operating system controls the
hardware and coordinates its use among the various application programs for the various users.
We can also view a computer system as consisting of hardware, software, and data. The operating
system provides the means for proper use of these resources in the operation of the computer
system.
User View
The user’s view of the computer varies according to the interface being used. Many computer users
sit with a laptop or in front of a PC consisting of a monitor, keyboard, and mouse. Such a system is
designed for one user to monopolize its resources. The goal is to maximize the work (or play) that
the user is performing. In this case, the operating system is designed mostly for ease of use, with
some attention paid to performance and security and none paid to resource utilization —how
various hardware and software resources are shared.
Increasingly, many users interact with mobile devices such as smartphones and tablets—devices
that are replacing desktop and laptop computer systems for some users. These devices are typically
connected to networks through cellular or other wireless technologies. The user interface for mobile
computers generally features a touch screen, where the user interacts with the system by pressing
and swiping fingers across the screen rather than using a physical keyboard and mouse. Many
mobile devices also allow users to interact througha voice recognition interface, such as Apple’s
Siri.
Some computers have little or no user view. For example, embedded computers in home devices
and automobiles may have numeric keypads and may turn indicator lights on or off to show status,
but they and their operating systems and applications are designed primarily to run without user
intervention.
System View
From the computer’s point of view, the operating system is the program most intimately involved
with the hardware. In this context, we can view an operating system as a resource allocator. A
computer system has many resources that may be required to solve a problem: CPU time, memory
space, storage space, I/O devices, and so on. The operating system acts as the manager of these
resources. Facing numerous and possibly conflicting requests for resources, the operating system
must decide how to allocate them to specific programs and users so that it can operate the computer
system efficiently and fairly.
A slightly different view of an operating system emphasizes the need to control the various I/O
devices and user programs. An operating system is a control program. A control program manages
the execution of user programs to prevent errors and improper use of the computer. It is especially
concerned with the operation and control of I/O devices.
Computer-System Operation
A modern general-purpose computer system consists of one or more CPUs and a number of device
controllers connected through a common bus that provides access to shared memory (Figure 1.2).
Each device controller is in charge of a specific type of device (for example, disk drives, audio
devices, and video displays). The CPU and the device controllers can execute concurrently,
competing for memory cycles. To ensure orderly access to the shared memory, a memory controller
is provided whose function is to synchronize access to the memory.
For a computer to start running-for instance, when it is powered up or rebooted-it needs to
have an initial program to run. This initial program, or bootstrap program, tends to be simple.
Typically, it is stored in read-only memory (ROM) or electrically erasable programmable read-only
memory (EEPROM), known by the general term firmware, within the computer hardware. It
initializes all aspects of the system, from CPU registers to device
controllers to memory contents. The bootstrap program must know how to load the operating
system and to start executing that system. To accomplish this goal, the bootstrap program must
locate and load into memory the operating- system kernel. The operating system then starts
executing the first process, such as "init," and waits for some event to occur. The occurrence of an
event is usually signaled by an interrupt from either the hardware or the software. Hardware may
trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus.
Software may trigger an interrupt by executing a special operation called a system call (also called a
monitor call). When the CPU is interrupted, it stops what it is doing and immediately transfers
execution to a fixed location. The fixed location usually contains the starting address where the
service routine for the interrupt is located.
The interrupt service routine executes; on completion, the CPU resumes the interrupted
computation. A time line of this operation is shown in Figure 1.3. Interrupts are an important part of
a computer architecture. Each computer design has its own interrupt mechanism, but several
functions are common. The interrupt must transfer control to the appropriate interrupt service
routine.
Types of Operating Systems
Some of the most widely used types of Operating system are,
1. Simple Batch System
2. Multiprogramming Batch System
3. Multiprocessor System
4. Distributed Operating System
5. Realtime Operating System
Disadvantages:
In batch processing method, there is no direct interaction between user and the computer.
Priority to important process cannot be provided.
CPU can be idle.
Multiprogramming Batch Systems
Aims to maximize CPU utilization. The operating system picks and executes one job from
memory. If the picked job needs an I/O operation, the OS immediately switches to another job for
executing that job making the CPU busy always. If several jobs are ready for execution at the
same time, CPU Scheduling is carried out.
In multiprogrammed system, CPU is always busy executing one process or the other.
Time-Sharing Systems aim is to minimizing the response time.
Multiprocessor Systems
It has several processors that share a common physical memory. Execution of several tasks by
different processors concurrently. If possible, system divides task into many subtasks and then
these subtasks can be executed in parallel in different processors. Provides higher computing power
and speed.
All processors operate under single operating system. Enhanced performance is achieved
Increases the system's throughput without speeding up the execution of a single task.
Distributed Operating Systems
Many computers are inter-connected by communication networks.
Multiple systems are involved in communication.
User at one system can utilize the resources of other systems.
Load can be distributed among systems.
Fast processing.
COMPUTER-SYSTEM ARCHITECTURE
A computer system can be organized as follows, based on number of general-purpose
processors used.
Single-Processor Systems
Multiprocessor Systems
Clustered Systems
Single-Processor Systems: If there is only one general-purpose CPU, then the system is a
single-processor system. A single processor system, has one main CPU for executing a
general-purpose instruction set. It also has processors for specific purposes. Device-specific
processors like disk controller, graphics controllers and I/O processor for quick access to
data are special purpose processors. The operating system sends these processors
information about their next task and monitors their status. The overhead of the main CPU is
relieved by the arrangement.
Multiprocessor Systems: Multiprocessor systems are also known as parallel systems have
two or more processors in close communication, sharing the computer bus, the clock,
memory, and peripheral devices. Three important advantages of Multiprocessor systems are
Increased throughput - more work is carried out in less time.
Low cost – since it shares peripheral devices there is much reduction in cost. Also
processors share data stored on a disk thereby reducing requirement of storage media.
Increased reliability – since many processors are used, failure of a single processor
would only slow down the system rather than halting altogether thereby increasing
reliability of a computer system.
The two types of multiple-processor systems are:
Asymmetric multiprocessing - each processor is assigned a specific task. One main
processor controls the system; the other processors get instructions from it or have
predefined tasks. The main processor schedules and allocates work to the remaining
processors.
Symmetric multiprocessing (SMP) - each processor has its own set of registers and
cache memory but all processors share common physical memory. Each processor
performs all tasks within the operating system. All processors are main peers. Figure 1.2
illustrates a typical SMP architecture.
Latest CPU design includes multiple computing cores on a single chip. Such
multiprocessor systems are termed multicore. Recent development is blade servers in
which multiple processor boards, I/O boards, and networking boards are placed in the
same chassis. Each blade-processor board boots independently and runs its own
operating system.Fig.1.2 SMP Architecture
Clustered Systems: Multiple CPUs are gathered together. Composes of two or more
individual systems / nodes joined together. Each node may be a single processor system
or a multicore system. Clustered computers share storage and are closely linked via a
Local Area Network (LAN). Clustering provides high reliability - service will continue
even if one or more systems in the cluster fail. Clustering can be structured
asymmetrically or symmetrically.
In asymmetric clustering, one machine is in standby mode while the other is running the
applications. The standby host machine monitors the active server. If the server fails, the
standby host becomes the active server.
In symmetric clustering, two or more hosts are running applications and are monitoring
each other. This structure is obviously more efficient, as it uses all of the available
hardware. More than one application must be available to run.
One set of operating-system services provides functions that are helpful to the user
communications – Processes may exchange information, on the same computer or between
computers over a network Communications may be via shared memory or through message
passing (packets moved by the OS)
Error detection – OS needs to be constantly aware of possible errors May occur in the CPU
and memory hardware, in I/O devices, in user program For each type of error, OS should
take the appropriate action to ensure correct and consistent computing Debugging facilities
can greatly enhance the user’s and programmer’s abilities to efficiently use the system
Another set of OS functions exists for ensuring the efficient operation of the system itself
via resource Sharing
Resource allocation - When multiple users or multiple jobs running concurrently, resources
must be allocated to each of them
Many types of resources - Some (such as CPU cycles, main memory, and file storage) may
have special allocation code, others (such as I/O devices) may have general request and
release code
Accounting - To keep track of which users use how much and what kinds of computer
resources
Protection and security - The owners of information stored in a multiuser or networked
computer system may want to control use of that information, concurrent processes should
not interfere with each other Protection involves ensuring that all access to system resources
is controlled
Security of the system from outsiders requires user authentication, extends to defending
external I/O devices from invalid access attempts If a system is to be protected and secure,
precautions must be instituted throughout it. A chain is only as strong as its weakest link.
User Operating System Interface - CLI
Command Line Interface (CLI) or command interpreter allows direct command entry
Sometimes implemented in kernel, sometimes by systems program sometimes multiple
flavors implemented – shells
Primarily fetches a command from user and executes it
User Operating System Interface - GUI
User-friendly desktop metaphor interface
Usually mouse, keyboard, and monitor Icons
represent files, programs, actions, etc
Various mouse buttons over objects in the interface cause various actions (provide information,
options, execute function, open directory (known as a folder)
Invented at Xerox PARC
Many systems now include both CLI and GUI
interfaces Microsoft Windows is GUI with CLI
“command” shell
Apple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells
available Solaris is CLI with optional GUI interfaces (Java Desktop, KDE)
System Calls:
System calls provide the interface between a process & the OS. These are usually available in the
form of assembly language instruction. Some systems allow system calls to be made directly from a
high level language program like C, BCPL and PERL etc. systems calls occur in different ways
depending on the computer in use. System calls can be roughly grouped into 5 major categories.
1. Process Control:
•End, abort: A running program needs to be able to has its execution either normally (end) or
abnormally (abort).
•Load, execute:A process or job executing one program may want to load and executes
another program.
•Create Process, terminate process: There is a system call specifying for the purpose of
creating a new process or job (create process or submit job). We may want to terminate a job
or process that we created (terminates process, if we find that it is incorrect or no longer
needed).
•Get process attributes, set process attributes: If we create a new job or process we should
able to control its execution. This control requires the ability to determine & reset the
attributes of a job or processes (get process attributes, set process attributes).
•Wait time: After creating new jobs or processes, we may need to wait for them to finish their
execution (wait time).
•Wait event, signal event: We may wait for a specific event to occur (wait event). The jobs or
processes then signal when that event has occurred (signal event).
2. File Manipulation:
•Create file, delete file: We first need to be able to create & delete files. Both the system calls
require the name of the file & some of its attributes.
•Open file, close file: Once the file is created, we need to open it & use it. We close the file
when we are no longer using it.
•Read, write, reposition file: After opening, we may also read, write or reposition the file
(rewind or skip to the end of the file).
•Get file attributes, set file attributes: For either files or directories, we need to be able to
determine the values of various attributes & reset them if necessary. Two system calls get file
attribute & set file attributes are required for their purpose.
3. Device Management:
•Request device, release device: If there are multiple users of the system, we first request
the device. After we finished with the device, we must release it.
•Read, write, reposition: Once the device has been requested & allocated to us, we can read,
write & reposition the device.
4. Information maintenance:
•Get time or date, set time or date:Most systems have a system call to return the current
date & time or set the current date & time.
•Get system data, set system data: Other system calls may return information about the
system like number of current users, version number of OS, amount of free memory etc.
•Get process attributes, set process attributes: The OS keeps information about all its
processes & there are system calls to access this information.