Você está na página 1de 21

Chapter 1

General Overview
Definition of an Operating
System (OS)
An operating system is a control
program for a computer that
performs the following operations:
 allocates computer resources
 schedules routine tasks
 provides a platform to run application
software for users to accomplish tasks
 provides an interface between the user &
the computer
History of Unix
 The Unix OS was developed by Ken
Thompson at the AT&T Bell Laboratories in
1969. He wanted to create an multi-user
operating system.
 Ken’s philosophy was to create an operating
system with commands or “utilities” that
would do one thing well (i.e. UNIX).
History of Unix OS
 The first versions of UNIX were
written in “machine-dependent”
program (such as PDP-7).
 Ken Thompson approached Dennis
Ritchie, developer of C language, and
in 1973 they compiled UNIX in C to
make operating system “portable” to
other computers systems.
UNIX Features
 The Unix OS is a multi-user OS allowing
more that more person to directly
communicate with the computer.
 Although the OS can only work on one task
at a time, a small piece of time (time slice)
is dedicated to each task or user - this is
referred to as “time-sharing”.
 Time sharing shows that the CPU is giving all
the users its full attention
Basic System Structure
 There are two important divisions in
UNIX operating system architecture.
1. Kernel

2. Shell

 In simple words –

 Kernel – interacts with the machine’s


hardware
 Shell – interacts with the user
The main concept that unites all the versions of Unix
is the following four basics −
 Kernel − The kernel is the heart of the operating

system. It interacts with the hardware and most of


the tasks like memory management, task scheduling
and file management.
 Shell − The shell is the utility that processes your

requests. When you type in a command at your


terminal, the shell interprets the command and calls
the program that you want. The shell uses standard
syntax for all commands. C Shell, Bourne Shell and
Korn Shell are the most famous shells which are
available with most of the Unix variants.
 Commands and Utilities − There are various
commands and utilities which you can make use
of in your day to day activities. cp, mv, cat
and grep, etc. are few examples of commands
and utilities. There are over 250 standard
commands plus numerous others provided
through 3rd party software. All the commands
come along with various options.
 Files and Directories − All the data of Unix is
organized into files. All files are then organized
into directories. These directories are further
organized into a tree-like structure called
the filesystem.
User Perspective

The high level features of unix system includes, mainly


three points
1) The File System.
2) The Processing Environment.
3) the building Block primitives.
User perspective
– The file system
The characteristics of unix file system are
•A hierarchal structure.
•Consistent treatment of data
•Ability to create and delete files
•Dynamic growth of files
•Peripheral devices are also treated as files
The file system is organized as a tree. The root node is
called “root” and is denoted by “/”. Every non leaf node
in this structure is a directory and every leaf node is a
file/special device file.
The name of the file is given by the path name.
If you want to locate the file date.c in the figure,
the path name will be /usr/src/cmd/date.c
Processing environment

 A source code is our program source code, an


executable file is the program for our source
code and the process is the instance of our
program in execution. Many processes can
execute simultaneously in Unix.
(Multiprogramming or multitasking). Also
many instances of one program can run
simultaneously. Each instance of this program
is one process. Various system calls allows
control of the state of the process. The state
of a process indicates its status at a particular
time. The process state could by any one of
the following.

 Process state information along with other useful information
is stored in a process control block. Every process has its
own process control block or PCB.
Unix shell allows three types of commands.
1. An executable file created by compilation of our source
code.
2. An executable command that contains a sequence of shell
commands.
3. An internal shell command.
 The shell, usually, run the commands synchronously.
However these commands can also be run asynchronously.
User perspective – building
block primitives
Unix allows user to write small programs,
in a modular way. These programs can be
used as building blocks to build the
complex programs.
Unix has three standard files:
 Standard input file

 Standard output file

 Standard error file


Operating system Services
 Process control: controlling the creating,
termination and suspension of processes.
 Scheduling processes: Since many programs
can execute simultaneously in UNIX the
process scheduling is also done by the kernel.
 Main memory management: allocating main
memory to the user programs and protecting
the memory region where kernel is running.
Also, protecting the memory region of one
process from another process.
 Virtual memory: managing the swap device
and handling the swapping system. Controlling
the pages in the paging system(memory
allocation)
 Secondary memory management: Managing
the secondary storage for the efficient and
timely retrieval and storage of data.
 Peripheral devices: kernel controls the
peripheral devices such as terminals, disk
drives and network devices.
Interrupt
 An interrupt is an event that changes the
sequence of instructions executed by the
processor.
 An interrupt is a signal from a device attached
to a computer or from a program within the
computer that requires the operating
system to stop and figure out what to do
next.
 There are two different kinds of interrupts:
 Synchronous interrupt
(Exception) produced by the CPU while
processing instructions
 Asynchronous interrupt (Interrupt) issued
by other hardware devices
Exceptions
 An exception occurs when a process does something
unexpected.
 Exceptions are caused by programming errors (i.e. Divide
error, Page Fault, Overflow) that must be handled by the
kernel. He sends a signal to the program and tries to recover
from the error.

The following two exceptions are classified:


 Processor-detected exception generated by the CPU while
detecting a anomalous condition; divided into three groups:
o Faults can generally be corrected.
o Traps report an execution.
o Aborts are serious errors.
 Programmed exception requested by the programmer,
handled like a trap.
Interrupt Handler
 An operating system usually has some
code that is called an interrupt handler.
 The interrupt handler prioritizes the
interrupts and saves them in a queue if
more than one is waiting to be handled.
 The operating system has another little
program, called a scheduler, that figures
out which program to give control to
next.

Você também pode gostar