Upload
api-26041653
View
144
Download
1
Tags:
Embed Size (px)
Citation preview
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 11
CS1002 - UNIX CS1002 - UNIX INTERNALINTERNAL
By. K.TAMIZHARASU , HOD/CSE, JCET
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 22
Brief UNIX HistoryBrief UNIX History
In 1969, Ken Thompson at AT&T Bell In 1969, Ken Thompson at AT&T Bell Labs began developing UnixLabs began developing Unix– First done in First done in assembly languageassembly language– Ran on Ran on DEC PDP-7DEC PDP-7 with with 8K8K words of words of
memorymemory In 1974, Unix was rewritten in In 1974, Unix was rewritten in CC
– By writing C compilers, Unix can be By writing C compilers, Unix can be portedported to other computersto other computers
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 33
BSD UNIXBSD UNIX– BSDBSD: Berkeley Software Distribution: Berkeley Software Distribution– UCB put the Internet Protocols (IP) into UCB put the Internet Protocols (IP) into
UNIXUNIX– 4.4BSD (Berkeley): 19944.4BSD (Berkeley): 1994
System VSystem V– AT&T System V (1984)AT&T System V (1984)– SVR4: System V Release 4 (current SVR4: System V Release 4 (current
version)version)
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 44
POSIXPOSIX– Portable Operating System Interface Portable Operating System Interface
for Computer Environments (1984)for Computer Environments (1984)– Most Unix systems try to conform Most Unix systems try to conform
with POSIX to a certain extentwith POSIX to a certain extent
This course is based on This course is based on SVR4SVR4 – Most of the things you will learn in Most of the things you will learn in
this course work in different Unix this course work in different Unix systems, perhaps with small systems, perhaps with small differencesdifferences
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 55
The UNIX The UNIX Tools (Utilities)Tools (Utilities)– Keep each tool Keep each tool simplesimple:: have each tool have each tool do do
one thingone thing, and do that one thing , and do that one thing reallyreally wellwell
– Keep tools Keep tools terseterse, not too talkative, not too talkative– More complex tasks can be accomplished More complex tasks can be accomplished
by by combining toolscombining tools together in together in scriptsscripts or or pipelinespipelines
– Originally, input and output to Originally, input and output to workstations were slow and tedious, and workstations were slow and tedious, and this approach made things faster and this approach made things faster and more efficientmore efficient
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 66
Overview of UNIXOverview of UNIX Supports various architecturesSupports various architectures Structure variesStructure varies Supports preemptive multitaskingSupports preemptive multitasking Multiuser environment - generally secureMultiuser environment - generally secure Supports multithreaded applicationsSupports multithreaded applications Protection/Security is high on modern Protection/Security is high on modern
versionsversions Supports symmetric multiprocessingSupports symmetric multiprocessing Highly scalabHighly scalablle/portable to various systemse/portable to various systems Many types/flavours of UNIX existMany types/flavours of UNIX exist
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 77
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 88
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 99
UNIX OSUNIX OS UNIX is very popular.UNIX is very popular. It is a unique, simple and easy to It is a unique, simple and easy to
understand structure.understand structure. Unix has a number of features.Unix has a number of features. Unix is a multi-user system.(Unix is a multi-user system.(More than one More than one
useruser)) It is a Multi-process or Multi-tasking.(It is a Multi-process or Multi-tasking.(More More
than one job at a timethan one job at a time)) Time Sharing.(Time Sharing.(More than one user can use More than one user can use
the system at anytimethe system at anytime.).) Portability – Portability – Unix is highly portableUnix is highly portable..
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1010
UNIXUNIX Layers Layers
The layers of a UNIX system.The layers of a UNIX system.
UserInterface
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1111
Structure of Unix systemStructure of Unix system
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1212
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1313
Structure of Unix SystemStructure of Unix SystemThe Unix system is supported by two agencies, 1. Kernel, 2. Shell.
The Kernal interact with the H/W.
The shell interact with user.(Relation between Kernal & shell).
KERNEL :
The Kernal is the heart of the system.
It is a collection of prog. Written in C. It communicates with the H/W directly.
There is only one Kernal for any system. The kernal is loaded into the memory
when the system is booted.
It manages the system resources.
It allocates time between users and processes.
It decides process priorities and perform all other tasks which we need not take
care off.
Kernal prog. Are independent of the H/W. The Kernal is often called the OS.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1414
Structure of Unix SystemStructure of Unix SystemSHELL:
The shell is the Sleeping Beauty.
This is an Unix Command.
It is the interpreter of user.
It takes a command from the user, translate it, exchanges information and communicates with the kernal and executes the command.
It is an I/F between the user and the kernal. The Shell insulates the user from the knowledge of kernal functions.
The shell takes care of redirection features (> and |).
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1515
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1616
Security for UnixSecurity for UnixUnix system has a number of facilities for protecting files.
Password changing.
Password Administration
File Permissions.
Communication:
Unix is used as a means of Electronic mail to communicate with each other.
Unix has a built in clock and calendar to store time and date.
The Unix has a scheduling mechanism enables s user to run any job at a specific time or to run it periodically.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1717
User PerspectiveUser PerspectiveThe UNIX system such as
•The File system•The Processing Environment•Building Block Primitives ( Ex. Pipes)
Characteristics of UNIX file SystemCharacteristics of UNIX file System • A hierarchical structure• Consistent treatment of file data.• The ability to create and delete files.• Dynamic growth of files.• Protection of file data.• Treatment of Peripheral devices as files.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1818
Context of a process
• Is its states as defined by its text.• Values of its global user variables and data structures.• Values of machine registers it uses, the value stored in its
process table slot and its user area.• The contexts of its user and kernel stack.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 1919
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2020
Different types of FilesDifferent types of Files
• Ordinary files
• Directories
• Special files
• Pipes
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2121
File SystemFile SystemThe UNIX system has very large number of files. So it should be organized in a systematic manner to locate the files.
Unix it is necessary to divide these things into three categories.
Ordinary Files or Regular Files. – A Steam of data which is resident on some permanent magnetic media.This includes all data, source prog. Object & executable code, all Unix prog. As well as any file created by the user.
The ordinary files are also referred to as a regular file. All the text files also belong to this type.
Directory Files. – A directory does not contain any data, but it keeps an account of all the files and sub-directories that it contains. The Unix file system is organized with a number of directories & sub-directories which can be created as and when required.
Device Files. – The physical device are considered as files. Physical device include printers, tapes, floppy disk, HDD,Terminal etc.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2222
Structure of the File Structure of the File SystemSystem
• File system is organized as a hierarchy of directories
• It starts from a single directory called root (represented by a /).
/(root)
|
--------------------------------------------------------------------
| | | | | |
/bin /dev /etc /tmp /usr /kernelfile
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2323
DirectoriesDirectories• Directory is file containing list of files and subdirectories
• It has fixed size records of 16 bytes each which contains - a filename(14 bytes)
- an inode number (2 bytes) which acts as a pointer to where the system can find info about the file.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2424
Special FilesSpecial Files• Special files are contained in the directory /dev.
• They are used to represent a real physical device such as a printer, tape device etc.
• Ex: Special device - /dev/null (unwanted output can be redirected).
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2525
PipesPipes
UNIX allows us to link commands together UNIX allows us to link commands together using a pipe. using a pipe.
The pipe acts as a temporary file which The pipe acts as a temporary file which only exists to hold data from one only exists to hold data from one command until its read by another.command until its read by another.
ex: ex: command1 | command2 | command3....command1 | command2 | command3....
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2626
Structure of File SystemsStructure of File Systems The login directory src can be specified as /usr/src. It is also called as a path name.
If the first character of the path name is “/”, then it indicates that the file location must be determined with respect to root. Such path names are called as Absolute Path Names.
A tree like structure enables us to create as many directories as required.
The tree like structure permits us to use two files with a same name, but in different directories.
The directories shown directly under root are normally found in every UNIX system.
The directories, “/tmp /bin/etc/usr/unix/dev”
• Are system directories and so one should not try to work in that directory.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2727
Structure of File SystemsStructure of File SystemsThe other directories /tmp and /usr are meant for the users.
The /bin and /usr/bin directories contain commands like, who, wc,cat, sh, date etc..
The /dev contain the device files of all H/W device. (/dev/tty00, /dev/tty01)
The /etc contain utilities used by the system administrator.(/etc/passwd)
The /tmp is used by some UNIX utilities (Visual Editor) as well as by a user to store temporary files.
The /usr directory contains all the files created by a user, including user login directory. (/usr/src, /usr/src/cmd/date.c)
Checking the current directory :
Syntax is : $pwd <Enter> . – Present working directory.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2828
Permission to access a file is controlled by access permissions associated with the file.
Access permissions can be set independently to control 1.Read , 2. Write and execute permission for three classes of users: * The file owner, * A file group and * others Users may create files if directory access permission allow it.The newly creates files are leaf nodes of the file systemdirectory structure.
Access Permissions
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 2929
Operating System Services:Operating System Services: • Controlling the execution of processes by allowing their creation termination or suspension, and communication.• Scheduling. Processes share the CPU in a Time-sharing manner.• Allocating main memory for an executing process. The kernel allows processes to share portions of their address space under certain conditions, but protects the private address space of a process from outside tampering. • If the kernel writes entire processes to a swap device, the implementation of the UNIX system is called a swapping system. If it write pages of memory to a swap device, it is called a paging system.• Allocating secondary memory for efficient storage and retrieval of user data. The kernel allocates secondary storage for user files, structures the file system in a well understood manner, and protect user files from illegal access.•Allowing process controlled access to peripheral devices such as terminals, tape drives, disk drives and network devices.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3030
Assumptions about H/WAssumptions about H/W:: The execution of user processes on UNIX systems is divided into two levels:* User Mode – Processes in user mode can access their instructions and data but not kernel instructions and data. Some machine instructions are privileged and result in an error when executed in user mode.
* Kernel Mode.- Can access kernel and user addresses.
When a process executes s system call, the execution of the process changes from user mode to kernel mode.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3131
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3232
Architecture of the UNIX OSArchitecture of the UNIX OS..
Block diagram of the system kernel.Two major components of the kernel- File subsystem and - process control subsystem.Three levels - User level.- Kernel level.- H/W level.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3333
The set of system calls into those that interact with 1. File subsystem and 2. Process control subsystem.
The file subsystem and the process control subsystem interact when loading a file into memory for execution.
Architecture of the Unix OS.Architecture of the Unix OS.
File subsystem manages files allocates file space. 1. Administers free space. 2. Controls access to files and retrieves data to users. 3. File subsystem uses buffering mechanism for block I/O 4.Device drivers and interacts directly with raw I/O device drivers.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3434
System KernelSystem Kernel
The File subsystem and those that interact with the Process control subsystem.
File subsystem:•Process interact with the file subsystem via a specific set of system calls, such as open, close, read, write, stat, chown (Change the record of owner), chmod ( i.e access permission).•The file system accesses file data using a buffering mechanism. Data flow between the kernel and secondary storage devices.•The buffering mechanism interacts with block I/O device drivers to initiate data transfer to and from the kernel. •Device drives are the kernel models that control the operation of
peripheral devices.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3535
Process Control SubsystemProcess Control SubsystemThe process control subsystem is responsible for process synchronization, interprocessor communication, memory management, and process scheduling.
The file subsystem and the process control subsystem interact when loading a file into memory for execution .The process subsystem reads executable files into memory before executing them.Some of the system calls:
•fork – Create a new process.•exec- Overly the image of a program onto the running process.•exit – Finish executing a process.•wait – synchronize process execution with the exit of a previously forked process).•brk – control the size of memory allocated to a process.•signal – control process response to extraordinary events.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3636
Memory management modulesMemory management modules Memory management modules controls the allocation of memory. The swapper process is sometime called the scheduler. The scheduler modules allocates the CPU to processes.
It schedules them to run in turn until they awaiting a resource or until the kernel preempts them when their recent run time exceeds a time quantum.
scheduler then chooses the highest priority eligible process to run; the original processes run again when it is the highest priority eligible process available. H/W controller is responsible for handling interrupts and for communicating with the machine. Device such as disks or terminals may interrupt the CPU while a process is executing.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3737
1. Important fields of ‘U’ area?
- a pointer to the process table slot of the currently executing
process parameters of the current system call, return values and
error codes
- file descriptors for all open files
- Internal 1/0 parameters
2. Services provided by the kernel?
-controlling the execution of processes by allowing their creation, termination or suspension and communication-scheduling processes fairly for the execution on the CPU-allocating main memory for an executing process-allocating secondary memory for efficient storage and retrieval of user data
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3838
System conceptsSystem conceptsIntroduction to System concepts:
• File system
• Process
- Context of a process
- Sate transitions
- Sleep and wakeup
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 3939
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4040
3. Fields of super block?
-the size of the file system
-the number of free blocks in the file system
-a list of free blocks available on the file system
-the index of the next free block in the free block list
4. Formula for computing the block number and byte offset of a mode in a block?Block number
Block nunv=((inode number-i )/number of modes per block)+ start block of mode list
Byte offset((mode number-i) modulo (number of modes per block))*size of disk mode
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4141
File systemFile system
Boot block super block inode list data blocks
• Boot block occupies the beginning of a file system. The first sector, and may contain the bootstrap code that is read into the machine to boot or initialize the OS. Only one boot block is needed to boot the system, every file system has a boot block.Inode List :
The kernel reference inodes (i.e. index node) by index into the inode list. One inode is the root inode of the file system. Administrators specify the size of the inode list when configuring a file system.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4242
Booting UNIXBooting UNIX (1) (1) The first sector of the boot disk (The first sector of the boot disk (master master
boot recordboot record) is read in and executed) is read in and executed This sector loads the This sector loads the bootboot program program Boot reads root directory, loads Boot reads root directory, loads kernelkernel and and
starts its executionstarts its execution Kernel reads the rest of the operating system Kernel reads the rest of the operating system
((main C-code sectionmain C-code section)) C code does some initialization, allocates C code does some initialization, allocates
system data structures, loads device drivers system data structures, loads device drivers and handcrafts the first process, and handcrafts the first process, process 0process 0
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4343
Booting UNIXBooting UNIX (2) (2)
The sequences of processes used to boot some systemsThe sequences of processes used to boot some systemscp
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4444
Super block
The size , no of free blocks available on the file system. The index of the next free block in the free block list, the size of the inode list, the no of free inodes in the file system. The list of free inodes in the file system, the index of the next free inode in the free inode list. Lock fields for the block and free inode list, a flag indicating the super block has been modified.Data Blocks:•The data blocks start at the end of the inode list and contain file data and administrative data. An allocated data block can belong to one and only one file in the file system.
A file system consists of a sequence of logical blocks, each containing 512, 1024, 2048 or multiple of 512 bytes, depending on the system implementation. Using large logical blocks increase the effective data transfer rate between disk and memory, because the kernel can transfer more data per disk operation and therefore make fewer time-consuming operations.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4545
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4646
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4747
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4848
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 4949
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5050
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5151
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5252
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5353
Many process appear to execute stimulatingly as the kernel schedules them for execution, and several processes may be instances of one program. A process on a, UNIX system is the entity that is created by the fork system call. Every process except process 0 is created when another process executes the fork system call. The process that invoked the fork system call is the parent process, and the newly created process is the child process. Every process has one parent process, but a process can have many child process. The kernel identifies each process by its process number, called the process ID (PID).
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5454
PROCESSPROCESS
Process 0 is a special process that is create by hand when the system boots; after forking a child process (process 1 ), process 0 becomes the swapper process. Process 1, known as init.
Discuss in detail about the various process transitions.
States of a process.
o The process is currently executing in user mode.o The process is currently executing in kernel mode.o The process is not executing but it is ready to run.o The process is sleeping.o State transition diagram.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5555
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5656
Process transitionsProcess transitions
•* State transition diagram Kernel allows context switch only when process moves from the state kernel running to the state a sleep in memory. Kernel is sometimes said to be non preemptive. The process moves from user mode to kernel mode on a system call or interrupt. The scheduler chooses he process that is ready to run. Context switch with example.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5757
Sleep and wakeup processSleep and wakeup process Sleep process : Processes go to sleep because they are awaiting the occurrence of some event. The event can be
Waiting for I/O completion from a peripheral device.
Waiting for a process to exit. Waiting for system resources to become available.
Sleeping processes do not consume CPU resources. Diagram for multiple processes sleeping on a lock.
While (condition is true)sleep (event: the condition becomes
false);Set condition true;
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5858
Wakeup ProcessWakeup Process On the occurrence of an event the sleeping process moves to the ready to run state. Kernel implements locks by checking a condition and sleeps the process. It unlocks the lock and awakens all the processes asleep on the lock.
Set condition false;wakeup (event: the condition is false);
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 5959
Building Block Primitives:
The Unix system is to provide OS primitives.• redirect I/O.• Pipe.
redirect I/O : Processes conventionally have access to three files.They read from their standard input file.Write to their standard output files. And Write error messages to their standard error file. Example : ls : Lists all the files in the current directory on the standard output. ls > output where > redirects the standard output to the file called :output “ in the current directory, using the create system call.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6060
The second building block primitive is the pipe: A mechanism that allows a stream of data to be passed between reader and writer processes.
Processes can redirect their standard output to a pipe to be read by other processes that have redirect their standard input to come from the pipe.
The programmer uses the pipe primitive and redirection of I/O to integrate the piece parts.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6161
Interrupts and exceptions :Interrupts to happen between the execution of two
instructions.The hardware usually prioritizes devices according to the
order that interrupts should be handled.
When the kernel services an interrupt, it blocks out lower priority interrupts but services higher priority interrupts.
Exceptions :
Exceptions happen “ in the middle “ of the execution of an instruction.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6262
Kernel Data StructuresKernel Data StructuresMost kernel data structure occupy fixed-size tables rather than dynamically allocated space. The file table, with one entry allocated for every opened file in the system, the user file descriptor table, with one entry allocated for every file descriptor known as a process, and the mount table, containing information for every active file system.
System Administration:Administrative processes are loosely classified as those process that do various functions. Such function include disk formatting, creation of new file systems, repair of damaged file systems, kernel debugging, and others.
Buffer Headers:The kernel allocates space for a number of buffers, configurable according to memory size and system performance. A buffer consists of two parts:A memory array – That contains data from the disk and a buffer header that identifies the buffer. A one to one mapping of buffer headers to data arrays.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6363
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6464
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6565
SVR4 – Morden Unix KernalSVR4 – Morden Unix Kernal
SVR4 (System Version Realizes 4) : Morden Unix Kernal: New features in the release include
Real-time processing supports Process scheduling classesDynamically allocated data structures Virtual memory managementVirtual file system and A preemptive kernel.
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6666
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6767
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6868
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 6969
UNIT-IUNIT-I K.TAMIZHARASU, HOD/CSE, JCETK.TAMIZHARASU, HOD/CSE, JCET 7070