Professional Documents
Culture Documents
Unix P4
Unix P4
Unix P4
Table of Contents
1. Introduction -----------------------------------------------------------------3
2. Design principle -----------------------------------------------------------4
3. User interface ---------------------------------------------------------------6
4. Process management ------------------------------------------------------7
5. Memory management ------------------------------------------------------7
6. File system -------------------------------------------------------------------8
7. Inter-process Communication --------------------------------------------10
8. Protection & security ------------------------------------------------------11
Introduction
Older operating systems are monolithic, that is, the whole operating system is a single a.out file that runs in
kernel mode. This binary contains the process management, memory management, file system and the rest.
Examples of such systems are UNIX, MS-DOS, VMS, MVS, OS/360 and MULTICS.
UNIX was originally developed in a laboratory at AT&Ts Bell Labs (now an independent corporation
known as Lucent Technologies).
Unix is a mature, technically superior group of operating systems with almost thirty years of continual
development, performed often by volunteers who believe in what theyre doing, has produced a group of
operating systems and extremely powerful multiprocessor server hardware tailor-made to its needs, whose
performance is still unparalleled by Intel hardware.
The alternative is a micro kernel-based system, in which most of the OS run as separate processes, mostly
outside the kernel. They communicate by message passing. The kernel's job is to handle the message
passing, interrupt handling, low-level process management, and possibly the I/O. Examples of this design
are the Chorus, Mach, RC4000 and Amoeba
Chorus was a research project on distributed systems at INIRA in France. It was bought by Sun
Microsystems in 1997.
The Chorus operating system is a highly scalable and reliable embedded operating system that has
established itself among top telecom suppliers. The Chorus operating system is used in public switches and
PBXs, as well as within access networks, cross-connect switches, voice-mail systems, cellular base
stations, web-phones and cellular telephones.
An open and flexible solution, the Chorus operating system also allows developers to rapidly respond to
customer needs and market conditions by quickly and cost-effectively creating and deploying new services
and mission-critical applications. With enhanced networking features, the Chorus operating system
seamlessly supports third-party protocol stacks, legacy applications, real-time and Java technology-based
applications simultaneously on a single hardware platform.
In this paper, I discuss the relative merits and demerits of the two operating systems. A sub-section on
Analysis and Evaluation of operating systems in comparison is provided at the end of each chapter.
Design Principle
A Chorus system is composed of a small nucleus and a set of system servers, which cooperate in the
context of subsystems.
PRASHANT PANDEY P4 SY IT
Chorus Nucleus is not the core of a specific operating system; rather it provides generic tools designed to
support a variety of host subsystems, which can coexist on top of the Nucleus.
This structure supports application programs, which already run on an existing operating system, by
reproducing the operating systems interface within a subsystem.
This classic idea of separating the functions of the operating system into groups of services provided by
autonomous servers is central to the Chorus philosophy. In monolithic systems, these functions are usually
part of the kernel. This separation of functions increases modularity, and therefore the portability of the
overall system.
Unix is a layered operating system. The innermost layer is the hardware that provides the services for the
OS. The operating system, referred to in Unix as the kernel, interacts directly with the hardware and
provides the services to the user programs. These user programs don't need to know anything about the
hardware. They just need to know how to interact with the kernel and it's up to the kernel to provide the
desired service. One of the big appeals of Unix to programmers has been that most well written user
programs are independent of the underlying hardware, making them readily portable to new systems.
User programs interact with the kernel through a set of standard system calls. These system calls request
services to be provided by the kernel. Such services would include accessing a file: open close, read, write,
link, or execute a file; starting or updating accounting records; changing ownership of a file or directory;
changing to a new directory; creating, suspending, or killing a process; enabling access to hardware
devices; and setting limits on system resources.
Unix is a multi-user, multi-tasking operating system. You can have many users logged into a system
simultaneously, each running many programs. It's the kernel's job to keep each process and user separate
and to regulate access to system hardware, including cpu, memory, disk and other I/O devices.
PRASHANT PANDEY P4 SY IT
User Interface
Analysis and Evaluation:
Programmers and users mainly deal with already existing systems programs; the needed system calls are
embedded within the program and do not need to be obvious to the user.
The most common systems programs are file or directory oriented.
Directory:mkdir,rmdir,cd,pwd
File:ls,cp,mv,rm
Other programs relate to editors (e.g.,emacs,vi), text formatters (e.g., troff, TEX), and other activities.
Shell the user process, which executes programs (also called command interpreter).
Called a shell, because it surrounds the kernel.
The shell indicates its readiness to accept another command by typing a prompt, and the user types
a command on a single line.
A typical command is an executable binary object file.
The shell travel through the search path to find the command file, which is then loaded and
executed.
The directories /bin and /usr/bin are almost always in the search path.
Typical search path on a BSD system: (./home/prof/avi/bin /usr/local/bin /usr/ucb /bin /usr/bin )
So far, there has been no mention of the user interface for UNIX. UNIX is a good operating system for
experienced programmers. The operating system was designed and implemented by experienced
programmers so everything, which the experienced programmer needs, is present but not much else. A
perfect example of this is the on-line documentation called "man-pages" or manual pages. The material is
completely reference oriented with very little tutorial information. Experienced programmers find the man
pages very useful but the beginning user often finds them overwhelming.
In the last few years, there has been extensive work to improve the user interface to UNIX. The most
dramatic effort has been the addition of windowing interfaces on top of UNIX such as X-windows,
Suntools, NextStep, Motif, OpenLook, etc. These windowing interfaces do not change UNIX itself but are
built on top of UNIX to provide a more intuitive interface to UNIX. Each of the different user interfaces
has some advantages and some disadvantages. Currently intensive development effort is being done on all
of these Graphical User Interfaces (GUIs).
PRASHANT PANDEY P4 SY IT
Process Management
A program in execution is called process in UNIX environment. Under UNIX system any number of
process can exist for a given program. Every process running under UNIX is identified by a process- id
(pid), an integer value. Each process is identified with the owner of the process, simply called uid.
Processes are arranged in a tree structure link. So except the root, all other process is attached with its
parent.
Unix is a timesharing system, which means that the processes take turns running. Each turn is a called a
timeslice; on most systems this is set at much less than one second. The reason this turns-taking approach
is used is fairness: We don't want a 2-second job to have to wait for a 5-hour job to finish, which is what
would happen if a job had the CPU to itself until it completed.
A process in Chorus defines a protected address space, which encapsulates the following resources: a set of
threads that share the resources of the process, a virtual memory context, and a set of ports for
communication with other processes. Every process has a protection identifier associated with it. If the
process forks, the children inherit the same ID. Protection identifiers provide a mechanism for
authentication.
There are three kinds of processes in Chorus, each having different execution privileges.
Supervisor processes execute in the same address space as the micro kernel and are permitted to
directly execute kernel instructions. They may also execute privileged I/O instructions.
System processes are permitted to execute kernel operations but may not execute privileged I/O
instructions. Unlike supervisor processes, system processes execute in a private address space.
User processes may execute neither kernel operations nor privileged I/O instructions. They run in
a private address space.
Many threads can execute concurrently within a process. Each thread is characterized by the state of the
processor. The scheduling scheme is very flexible: although the basic scheme is priority-based, Chorus also
supports time-slicing and priority degradation on a per-thread basis.
Memory Management
Abstract memory objects are typically provided to protect regions of memory. Virtual memory management
may be implemented as part of the kernel or user-level process.
The Unit of data abstraction in Chorus is called the segment. Segments generally represent some form of
secondary storage such as a file. Similarly to other abstractions in Chorus, segments are global and are
identified by capabilities.
Each process address space is divided into regions. A region is a contiguous range of virtual addresses
within a process, which maps a portion of a segment to a given virtual address. Associated with each
mapping is a set of access rights.
PRASHANT PANDEY P4 SY IT
System processes known as mappers are responsible for mapping segments onto regions. If a process
makes a request to read or modify data within a region, the mapper returns the appropriate segment
containing the data. Segments are swapped on a demand basis by a user level process called the External
Mapper.
UNIX Memory Management
All memory assigned as pages
Each user process works in a virtual 4GB memory space
Multi-User nature of UNIX requires that no memory be allocated to absolute locations
Unix memory management is based on Demand-paged virtual memory system. It employs the Least
Recently Used algorithm.
Each process has a separate virtual address space. This virtual memory is implemented via demand paging.
Pages in physical memory are selected for replacement using a modified working-set policy. A page that
has not been referenced in a certain length of time is considered no longer to be in the working set of any
process; thus it becomes a candidate for replacement. It is possible that the working sets of the processes
being run might require more pages than can fit into memory. If this happens, one or more of the processes
is temporarily suspended. Pages being used by these processes are removed form memory to make more
room available.
File System
A file system is a logical method for organizing and storing large amounts of information in a way that
makes it easy manage. The file is the smallest unit in which information is stored. The UNIX file system
has several important features.
Types of Files in Unix:
To the user, it appears as though there is only one type of file in UNIX, the file that is used to hold your
information. In fact, the UNIX file system contains several types of file.
Ordinary files: This type of file is used to store your information, such as some text you have
written or an image you have drawn. This is the type of file that you usually work with.
Directories: A directory is a file that holds other files and other directories. You can create
directories in your home directory to hold files and other sub-directories.
Special files: This type of file is used to represent a real physical device such as a printer, tape
drive or terminal. It may seem unusual to think of a physical device as a file, but it allows you to
send the output of a command to a device in the same way that you send it to a file.
Pipes: UNIX allows you to link commands together using a pipe. The pipe acts a temporary file
that only exists to hold data from one command until another reads it.
PRASHANT PANDEY P4 SY IT
IDE disks
RAM disks
NFS Server, which allows to mount local file systems from a remote system.
PRASHANT PANDEY P4 SY IT
Inter-process Communication
IPC is a set of programming interfaces that allow you to create and manage individual program processes
that can run concurrently in an operating system. This allows a program to handle many user requests at the
same time.
The various IPC methods are:
Pipes and named pipes
Message queuing
Semaphores
Shared memory
Sockets
RPC
IPC is provided for the following reasons:
In-order delivery of data - so that the receiving process reads messages in the order that they are
sent.
Unduplicated delivery of data - so that the receiving process only gets each message once.
Reliable delivery of data - so that no data is lost.
Preservation of message boundaries - so that individual messages are not mixed up into one.
Support for out-of band messages - so that "emergency" situations can be handled on the same
channel.
Connection oriented communication - so that a connection can be established between two
independent processes before any other communication takes place.
Asynchronous Message-passing does not guarantee delivery of message. During asynchronous message
transfer no notification is sent to the sender. Asynchronous message passing reduces network traffic. It has
higher performance and provides better scaling to large or busy networks.
Synchronous RPC is based on the client-server model. It guarantees delivery of message by sending
notification to the sender. It is a simple concept, which is easy to understand. It is easy to handle in case of
errors or crashes.
Processes in Unix based systems communicate between themselves through IPC constructs. Among these
are:
Pipes
FIFO (named pipes)
Streams (Files)
Sockets
Messages: Exchange messages with any process or server.
Semaphores: Allow unrelated processes to synchronize execution.
Shared memory: Allow unrelated processes to share memory.
PRASHANT PANDEY P4 SY IT
PRASHANT PANDEY P4 SY IT
PRASHANT PANDEY P4 SY IT
10