You are on page 1of 7

ITE2002-(OPERATING SYSTEM)

SLOT-B1+TB1
SUBMITTED BY- ASHISH RAJ (16BIT0138)
SUBMITTED TO- PROF. SHASHIKIRAN V.
SITE

Report on UNIX Operating System


The UNIX operating system is a set of programs that act as a link between the computer and the
user.

Unix is the multi-user multitasking Operating system. UNIX is an operating system. It is a stable,
multi-user, multi-tasking system for servers, desktops and laptops.
The UNIX Architecture-
Different Layers of the UNIX Architecture:

UNIX architecture consists of following components as mentioned below:

Hardware: This refers to the Hardware layer of any system.


Kernel: The UNIX operating system kernel is the core of the system and acts as an interface
between user and hardware. It also performs the tasks like: the process management, memory
management, file system, and I/O system and communications in response to system Calls.
Many application subsystems and programs that provide a high-level performance of the system,
such as the shell and editors, have gradually been seen as features of the UNIX operating system
Shell: Users communicate with the kernel through a program known as the shell. A UNIX shell
is an important interface between the user and the operating system, and also a programming
tool for users to write their own commands. When a user logs in, the login program checks the
username and password, and then starts another program called the shell. The shell is a command
line interpreter (CLI). It interprets the commands the user types in and arranges for them to be
carried out.
It uses the standard syntax for all commands.
There are various kinds of commands like C Shell, Bourne Shell, and Korn Shell etc.
Commands: There are different kinds of commands which are used. cp, cat, grep and ls are
commands which are used to perform operations on UNIX.
User: communicates with Shell through Commands.
Files and processes:
Everything in UNIX is either a file or a process.
A process is an executing program identified by a unique PID (process identifier).
A file is a collection of data. They are created by users using text editors, running Compilers etc.
The Directory Structure:
A directory is a file whose data is a sequence of entries, each consisting of an inode number and
the name of a file contained in the directory.
All the files are grouped together in the directory structure. The file-system is arranged in a
hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root.
General Characteristics of UNIX:
UNIX is, at its base level, a multi-user, multitasking, virtual memory operating system that runs
on a wide variety of hardware platforms. This means that Unix is able to do many things at the
same time, for many different users, and using more memory than it really has physically
installed. From a user's perspective this is very nice, and from an operating systems point of
view, it is very interesting. But UNIX really is much more than just an operating system; it is a
philosophy of using and programming a computer that gets its power from the relationships
between programs rather than the programs themselves.
Unix is a multi-user system: This means that inherent to Unix is the idea that there are
different users of the system, and that different users may have different sorts of
privileges and types of access to different parts of the system. It allows for the idea that
some users may want to protect some of their data from being accessed by other users on
the system. So, in being a multi-user system, the basic ideas of system security and data
privacy come up. Likewise, there must be some way to identify one user from another in
a multi-user system. Unix uses a system of login names to identify users and passwords
to authenticate that a user is, in fact, who she claims to be.
Unix is a multitasking system: This means that Unix has the ability to handle more than
one task at a time. These tasks might be several programs that any particular user wants
to run, or they may be programs run by several users at once. Multitasking, combined
with being a multi-user system, makes it possible for more than one person to be logged
in and using a Unix system at once. This is true for any Unix system, not just large
timesharing systems. Even small, desktop systems have the capability to support multiple
concurrent users. Additionally, some of the tasks that the system could be doing, and
probably is doing, can be system tasks related to keeping the system going and providing
the services needed by the users.
Unix is a virtual memory operating system: In a virtual memory system, the system
behaves as if it has much more memory than is physically installed. Some portion of the
disk is used to simulate extra memory. This idea makes it possible to run large programs
on a smaller system. Some tradeoff exists between the amount of memory that a program
uses and how fast it will run, since if it is very large, it must access the disk a lot, but it
will eventually run. In a multitasking environment, tasks that are not currently running
can be moved out of memory and onto disk to free up memory for tasks that more
urgently need it. The overall result is better use of the system resources for all involved.
UNIX Interfaces:
Graphical User Interfaces (GUIs)
When we logon locally, we are presented with graphical environment.
We start at a graphical login screen. We must enter our username and password.
Once we enter in our username and password, we are then presented with a graphical
environment.
Command Line Interface(CLI)
We also have access to some UNIX servers as well We can logon from virtually any
computer that has internet access whether it is Windows, Mac, or UNIX itself.
In this case we are communicating through a local terminal to one of these remote
servers All of the commands actually execute on the remote server. It is also possible to
open up graphical applications through this window, but that requires a good bit more
setup and software.
Process Management
A program is an executable file while a process is an instance of the program in
execution. Many processes can execute concurrently on the UNIX operating system
(Multiprogramming). In a UNIX system, the only active entities are the processes. Each
process runs a single program and initially has a single thread of control. Process
management of the UNIX operating system is typically responsible for tasks: to create,
suspend and terminate processes, to switch their states, to schedule the CPU to execute
multiple processes concurrently in a time-sharing system, and to manage the
communication between processes (inter-process communication, IPC).
Operating system functions executes within user process.
Two modes of execution User mode Kernel mode
When a process executes a system call, the execution mode of the process changes from
user mode to kernel mode, the operating system executes and attempts to service the user
request, returning an error code if it fails.
Processes in user mode can access their own instructions and data but not kernel
instructions and data. Processes in kernel mode, however, can access kernel and user
addresses. For example, the virtual address space of a process may be divided between
addresses that are accessible only in kernel mode and addresses that are accessible in
either mode.
Two types of processes are available System processes (Execute OS code) User
processes (Execute user program code)
Process State in UNIX
User running Execute in user mode
Kernel running Execute in kernel mode
Ready to run in memory ready to run as soon as the kernel schedules it
Asleep in memory unable to execute until event occurs.
Ready to run, swapped process is ready to run, but the swapper must swap process into
main memory before kernel can schedule it to execute.
Process Scheduling Queues
Job queue
Ready queue
Device queues.
Types of Processes in UNIX
Mainly 3 types User process Daemon process Kernel process
User process: Most processes on typical systems are user processes, associated with
users at a terminal.
Daemon process: Daemon processes are not associated with any users but do system-
wide functions, such as administration and control of networks, execution of time-
dependent activities, line printer spooling, and so on.
The function can be of any auxiliary kind but they are vital in controlling the
computational environment of the system. Once created Daemon process can exist
throughout the life time of the Operating System.
Kernel process: Kernel processes execute only in kernel mode.
Kernel processes are similar to daemon processes in that they provide system-wide
services, but they have greater control over their execution priorities since their code is
part of the kernel.

System calls in UNIX


Fork() - This system call create new process.
Exec() -This system call used after a fork to replace the process memory space with a
new program.
Wait() -This system call moves a process off the ready queue until the termination of the
child.
Memory management:
The memory management just handles how to load the program into the user memory
space from the disk when a program is typed by a user and leaves the process
management to accomplish the program execution. When a new program name is typed
by the user after the first one finishes, the memory management also loads it into the
same space and overwrite the first one.
In multiprocessing operating systems, there are many processes that represent different
programs to execute simultaneously, which must be put in different areas of the memory.
The memory management system decides which processes should reside (at least
partially) in main memory
It monitors the amount of available primary memory and may periodically write
processes to a secondary device called the swap device to provide more space in primary
memory
At a later time, the kernel reads the data from swap device back to main memory.
Kinds of Memory:
Main - The physical Random Access Memory located on the CPU motherboard.
The main memory must accommodate both the operating system and the various user
processes.
Secondary memory- This memory holds those pages that are not present in main
memory. The secondary memory is usually a high-speed disk. It is known as the swap
device, and the section of disk used for this purpose is known as Swap space.
Swap space is most efficient when it is on a separate disk or partition, but sometimes it is
just a large file in the File System
File System - Disk memory accessible via pathnames. This does not include raw
devices, tape drives, swap space, or other storage not addressable via normal pathnames.
It does include all network file systems.
OS Memory Uses:
Kernel - The Operating Systems own private memory space. This is always in Main
memory.
Cache - Main memory that is used to hold elements of the File System and other I/O
operations. Not to be confused with the CPU cache or disk drive cache, which are not
parts of main memory.
Virtual - The total addressable memory space of all processes running on the given
machine. The physical location of such data may be spread among any of the three kinds
of memory.
UNIX Memory Management Policies:
Swapping - Easy to implement, less system overhead
Demand Paging - Greater flexibility

Swapping
A process must be in memory to be executed. A process, however, can be swapped
temporarily out of memory to a backing store and then brought back into memory for
continued execution.
The swap device is a block device in a configurable section of a disk.
Kernel allocates contiguous space on the swap device without fragmentation.
It maintains free space of the swap device in an in-core table, called map
The kernel treats each unit of the swap map as group of disk blocks
As kernel allocates and frees resources, it updates the map accordingly Swapping
Process Out.
The kernel must gather the page addresses of data at primary memory to be swapped
out.
Kernel copies the physical memory assigned to a process to the allocated space on the
swap device.
The mapping between physical memory and swap device is kept in page table entry.
Demand Paging
A demand-paging system is similar to a paging system with swapping. When we want to
execute a process, we swap it into memory. Rather than swapping the entire process into
memory.
Not all page of process resides in memory Locality.
When a process accesses a page that is not part of its working set, it incurs a page fault.
The kernel suspends the execution of the process until it reads the page into memory
and makes it accessible to the process
File Management in UNIX:
In UNIX there are three basic types of files:
Ordinary Files: An ordinary file is a file on the system that contains data, text, or
program instructions. In this tutorial, you look at working with ordinary files.
Directories: Directories store both special and ordinary files. For users familiar with
Windows or Mac OS, UNIX directories are equivalent to folders.
Special Files: Some special files provide access to hardware such as hard drives, CD-
ROM drives, modems, and Ethernet adapters. Other special files are similar to aliases or
shortcuts and enable you to access a single file using different names.
File Management in UNIX File Access Modes:
Read: Grants the capability to read i.e. view the contents of the file.
Write: Grants the capability to modify, or remove the content of the file. Execute: User
with execute permissions can run a file as a program.
File Management in UNIX Directory Access Modes:
Read: Access to a directory means that the user can read the contents. The user can look
at the filenames inside the directory.
Write: Access means that the user can add or delete files to the contents of the directory.
Execute: Executing a directory doesnt really make a lot of sense so think of this as
traverse permission. A user must have executed access to the bin directory in order to
execute or command.
File Management in UNIX Starting a Process:
Foreground Processes: By default, every process that you start runs in the foreground. It
gets its input from the keyboard and sends its output to the screen.
Background Processes: A background process runs without being connected to your
keyboard. If the background process requires any keyboard input, it waits. The advantage
of running a process in the background is that you can run other commands; you do not
have to wait until it completes to start another.
File Management in UNIX Stopping Processes:
Ending a process can be done in several different ways. Often, from a console-based
command, sending a CTRL + C keystroke (the default interrupt character) will exit the
command. This works when process is running in foreground mode.
If a process is running in background mode then first you would need to get its Job ID
using ps command and after that you can use kill command to kill the process.
UNIX Security:
File Permissions
Login daemons
Non-login daemons
Stack Smashing
Safe Script
References:
Bach MJ (2006) The design of the UNIX operating system.
Tanenbaum AS (2005) Modern operating systems, 2nd edn.
Stallings W (1998) Operating systems: Internal and design principles 3rd edn.
Katzan H Jr (1970) Operating system architecture.
The Design of the UNIX Operating system Maurice J. Bach
A. Silberschatz, P.B. Galvin & G. Gagne, Operating System Concepts

You might also like