Sei sulla pagina 1di 14

UNIT I COMPUTER SYSTEM AND OPERATING SYSTEM OVERVIEW

Operating system: It is a program that acts as an interface between the computer user
and the computer hardware.
1.1 What Operating Systems Do:
A computer system can be divided roughly into four components: the hardware, the
operating system, the application programs and the users.
Hardwarethe CPU, the memory, and the I/O devicesprovides the basic computing

resources for the system.


Application programsword processors, compilers, and web browsersdefine the ways in

which these resources are used to solve users' computing problems.


Operating system controls and coordinates the use of the hardware among the various

application programs for the various users.


An operating system is like a government as it performs no useful function by
itself. It provides an environment within which other programs can do useful work.

Operating system's role can understand from two viewpoints


1.1.1 User View: The operating system is designed mostly for ease of use.
R esource utilizationhow various hardware and software resources are shared.

Ex: A user sits at a terminal connected to a mainframe , Other users are accessing the same

computer through other terminals. These users share resources and exchange information.
1.1.2 System View:
OS acts as a resource allocator. A computer system has many resources that may be
required to solve a problem: CPU time, memory space, I/O devices, and so on.
An operating system is a control program manages the execution of user programs to
prevent errors and improper use of the computer.
1.1.3 Defining OS:
Kernel: The operating system is the one program runningat all times on the computer .

1.2 Computer-System Organization


1.2.1 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. The CPU and the
device controllers can execute concurrently.

To run a computer, when it is powered on or rebootedan initial program (bootstrap


program) has to run. It is stored in read-only memory (ROM). It initializes all aspects of the

system. The bootstrap program must locate and load operating system into memory. The
operating system then starts executing the first process, "init," and waits for some event to
occur.The occurrence of an event is an interrupt caused by either hardware or software.
Hardware interrupt is by sending a signal to the CPU. Software interrupt by executing a

special operation called a system call(monitor call).

1.2.2 Storage Structure:

Main memory is the only large storage area that the CPU can access directly.
It is usually too small to store all needed programs and data permanently.
It is a volatile storage device that loses its contents when power is turned off.
secondary storage is able to hold large quantities of data permanently.
Example is a magnetic disk, which provides storage for both programs(compilers, word
processors) and data are stored on a disk until they are loaded into memory.
The main differences among the various storage systems lie in speed, cost, size,
and volatility.

Hierarchy of storage systems according to speed and cost. The higher levels are expensive,
but they are fast. As we move down the hierarchy, the cost decreases, whereas the access
time increases.
An electronic disk can be designed to be either volatile or nonvolatile. The electronic disk
stores data in a large DRAM array, which is volatile. Flash memory is slower than DRAM but
needs no power to retain its contents. So it is non volatile.

1.2.3 I/O Structure

small computer-systems interface (SCSI) controller can attach seven or more devices.
A device controller contains local buffer and a set of special-purpose registers. It is
responsible for moving the data between the peripheral devices and its local buffer storage.
OS have a device driver for each device controller. This device driver acts as a interface
between the device and the rest of the operating system.
To start an 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.
DMA
The device controller transfers an entire block of data directly to or from its own buffer 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.

ADVANTAGES:
1. It is used for high-speed I/O devices
2. CPU can not sit idle.

1.3 Computer-System Architecture

1.3.1 Single-Processor Systems:

There is one main CPU capable of executing a general-purpose instruction set, including
instructions from user processes. All of these special-purpose processors run a limited
instruction set and do not run user processes.
1.3.2 Multi-processor Systems:
They have more than one processor sharing bus, clock, and memory and peripheral devices.
These systems also called as tightly coupled systems.

Advantages:
1. Increased throughput. By increasing the number of processors, more work can be done
in less time so number of users also increased.
2. Economy of scale: They can share peripherals,memory, and power supplies. If several
programs operate on the same set of data, it is cheaper to store those data on one disk and
to have all the processors share them.
3. Increased reliability. If functions can be distributed among several processors, then the
failure of one processor will not halt the system, only slow it down. If we have ten
processors and one fails, then each of the remaining nine processors can pick up a share of
the work of the failed processor.
1.3.3 Clustered Systems:

1.4 Operating-System Structure


Multiprogramming: The operating system keeps several jobs in memory simultaneously.
Purpose:
The operating system picks and begins to execute one of the jobs in memory. Eventually,
the job may have to wait for some task, such as an I/O operation, to complete. The OS
simply switches to, and executes another job. When that job needs to wait, the CPU is
switched to another job, and so on.The first job finishes waiting and gets the CPU back.
Advantages:
1. Incresed CPU utilization
2. CPU is never sit idle.

Time sharing (or multitasking)


The time-shared operating system allows many users to share the computer simultaneously.
only a little CPU time is needed for each user.
The CPU executes multiple jobs by switching among them, but the switches occur so
frequently that the users can interact with each program while it is running.

Advantages:
1. interactivity, which provides direct communication between the user and the system.
The user gives instructions to the OS or to a program directly, using a input device such as a
l
2.response time should be shorttypically less than one second.
1.4 Operating-System Operations

A trap is a software-generated interrupt caused either by an error (ex:division by zero) or


by a specific request from a user program that an OS service be performed.
1.4.1 Dual mode operation:
There are two separate modes of operation:user mode and kernel mode (also called
supervisor mode, system mode, or privileged mode). A bit, called the mode bit, is
added to the hardware of the computer to indicate the current mode: kernel (0) or user (1).

At system boot time, the hardware starts in kernel mode. The OS then loaded and starts
user applications in user mode. Whenever a trap or interrupt occurs, the hardware switches
from user mode to kernel mode(i.e. mode bit 1 to 0). After detection control is return to
user by switching to user mode (from 0 to 1).

We have some machine instructions that may cause harm as privileged instructions which
should be executed only in kernel mode.

Advantage: protects the operating system from errant users.

1.5.2 Timer : This is used to prevent a user program from getting stuck in an infinite loop
and never returning control to the operating system. A timer can be set to interrupt the
computer after a specified period. The period may be fixed or variable . A variable timer is
generally implemented by a fixed-rate clock and a counter.The OS sets the counter. Every
time clock ticks, the counter is decremented. When counter reaches 0, an interrupt occurs.
1.6 Process Management
1.7 Memory Management
1.8 Storage Management
1.8.1 File-system Management
1.8.2 Mass-storage Management
1.8.3 Caching

1.8.4 I/O Systems

1.9 Protection and Security

1.10 Distributed Systems:


The processors communicate with one another through various communication lines, such as
high-speed buses or telephone lines. They also called as loosely coupled systems.The
processors do not share memory or a clock.Each processor has its own local memory.

A network, is a communication path between two or more systems. A local-area network


(LAN) connects computers within a building. A metropolitan-area network (MAN) link
buildings within a city. A wide-area network (WAN) links countries.

Advantages:

Resource sharing: If a number of different sites are connected to one another, then a
user at one site may be able to use the resources available at another. For example, a user
at site A may be using a laser printer available only at site B. Meanwhile, a user at B may
access a file that resides at A.
Computation speedup: If computation can be partitioned into a number of
subcomputations that are distributed among the various sitesto run concurrently.

Reliability:If the system is composed of a number of sites, the failure of one site should
not affect the rest.

Communication: There are many instances in which programs need to exchange data
with one another on one system eg: Window systems. A user can send mail to another user
at the same site or at a different site.

1.11 Special-Purpose Systems

1.11.1 Real-Time Embedded Systems


A real-time has well defined, fixed-time constraints. Processing must be done within the
defined constraints otherwise system will fail. Embedded systems always run on rel-time
o/s. I is used when rigid time is required for the operation of processor. Ex: home-appliance
controllers.

1.11.2 Multimedia Systems:


It has wide range applications that are popular today. It include a combination of both audio
and video files.Ex: MP3 DVD movies, video conferencing,short video clips etc.

1.11.3 Handheld Systems:


It includes PDAs(Personal Digital Assistants) such as pocket PCs and cell phones processing
will be very fast. Some handheld devices like cellphones uses wireless technology such as
bluetooth allows remote acess to e-mail and web browsing.

2.1Operating-System Services:
OS provide the following services to user.
User interface: This interface can take several forms. command-line interface(CLI),
which provides a method for entering text commands.Batch interface, in which commands
and directives to control those commands are entered into files, and those files are
executed. Graphical user interface (GUI) is a window system with a pointing device to
direct I/O, choose from menus, and make selections and a keyboard to enter text.
Program execution: The system must able to load a program into memory and then run
that program. The program must end its execution, either normally or abnormally (error).
I/O operations: A running program may require I/O, which may involve a file or an I/O
device. For efficiency and protection, users usually cannot control I/O devices directly.They
are controlled by OS.
File-system manipulation: Programs need to create,delete, read and write files and
directories.Some programs include permissions to allow or deny access to files or directories
Communications: One process needs to exchange information with another process.
Such communication may occur between processes that are executing on the same
computer or on different computer systems. Communications may be implemented via
shared memory or through message passing, in which packets of information are moved
between processes by the OS.
Error detection: Errors may occur in the CPU(power failure) and memory hardware
(memory error), in I/O devices (lack of paper in the printer),and in the user program
(arithmetic overflow). For each type of error, the OS should take the appropriate action.

OS provide some following important functions.


Resource allocation. When there are multiple users or multiple jobs running at the same
time, resources must be allocated to each of them. As many different types of resources are
managed by the OS, it has to allocate resources to users in a proper manner.
Accounting. We want to keep track of information about how many number of users,what
kinds of computer resources. This record keeping may be used for reconfigure the system to
improve computing services.
Protection and security. The owners of information stored in networked computer system
may want to control use of that information.
Protection involves ensuring that all access to system resources is controlled. Security
requires each user to authenticate himself to the system,by means of a password, to gain
access to system resources.

2.3 System Calls


System calls provide an interface between process and operating system. These calls are
generally available as routines written in C and C++,certain low-level tasks (ex:hardware
must be accessed directly), may need to be written using assembly-language instructions.
example to illustrate how system calls are used: writing a
simple program to read data from one file and copy them to another file. The
first input that the program will need is the names of the two files: the input file
and the output file.

We will see the working of open() system call.


2.4 Types of System Calls

System calls can be grouped roughly into five major categories:

Process control
o end, abort
o load, execute
o create process, terminate process
o get process attributes, set process attributes
o wait for time
o wait event, signal event
o allocate and free memory
File management
create file, delete file
o open, close
read, write, reposition
o get file attributes, set file attributes
Device management
o request device, release device
read, write, reposition
o get device attributes, set device attributes
logically attach or detach devices
Information maintenance
o get time or date, set time or date
o get system data, set system data
o get process, file, or device attributes
o set process, file, or device attributes
Communications
0 create, delete communication connection
send, receive messages
o transfer status information
o attach or detach remote devices

2.7 Operating-System Structure

2.7.1 Simple Structure


Many commercial systems do not have well defined structure. Ex: Ms-DOS which was written to
provide the most functionality in least space so it was not divided into modules
It has no dual mode and no h/w protection

FIG

Another example is original UNIX o/s . UNIX consists of two separate parts: the kernel and the
system programs. Kernal provides file systems, cpu scheduling,memory mngmt etc.
FIG
2.7.2 Layered Structure:
OS is broken up into number of layers. The bottom layer (layer 0) is the h/w and the highest
layer(layer N) is the user interface.
Adv:
Simplicity of construction and debugging.
Each layer is implemented with only those operations provided by lower-level layers. A layer does
not need to know how these operations are implemented but has to know what these operations to
do.
DADv:
Difficulty in defining various layers becoz a layer can use only low-level layers.
Less efficient.

Microkernels:

Modules:
The best current methodology of o/s design involves using OO programming techniques to
create a modular kernel. The kernel has a set of core componenets and dynamically links in
additi nal services during run time.
Solar o/s structure is organized a core kernel with 7 types of loadable ker nel modules.

Potrebbero piacerti anche