Monday 29 December 2014

Overview of UNIX system

who invented UNIX system?

UNIX system was first described in 1974 by ken Thompson and Dennis Ritchie.
Thompson and Ritchie implemented the UNIX On PDP-7 computer and later on PDP-11
( 1971 )
In 1973 the UNIX was written in C programming language.

Architecture of UNIX System

What are inputs and outputs of UNIX system?
Each and Every file has its own file descriptor. file descriptor contains the information related to weather we are reading data from file or writing data to the file.

              1.Input and output uses file descriptors.
              2.Small non-negative integers .
              3.All shells open three descriptors
        a.standard input(stdin: default return value is 0) 
     b.standard output(stdout: default return value is 1) 
      c.standard error(stderr: error number will be returned)

What is meant by Program?

Collection of instructions and data in a file is called program. 
File contents are arranged according To the rules established by kernel. 
After compiling program, we will get an object file. This object file resides on the hard disk. 
List of instructions read from memory and executed by kernel. 

Explain the need of process in UNIX Operating System?
An executing instance of a program is called process. 
Kernel creates a new process.
environment in which program executes is also called as process.
Creation of new process is done By issuing a system call.
The program is used to initialize Instructions and User data.

Process system data includes the following attributes
 Current directory.
Open files.
Descriptors.
Accumulated CPU time…
A process cannot access/ modify The system data directly.

Process ID and Process Groups
Every process has a process ID.
Guaranteed to have unique positive integer.
All processes have a parent
Related processes can be organized into process groups.
One group member is the group leader.
Each member has the process-group-ID.
A process group can have a control terminal
When group leader terminates, All process with the same control terminal are sent hangup signal.
Process ID        Uniquely identifies a process.
Parent-process ID      Process -ID of the process’s parent
Process group ID        Process ID of the group leader
Permissions in UNIX.
positive integers associated with user’s login name Called Real user ID,Real group ID.
Two ID’s associated with a process are effective user ID and effective group ID.
Error Handling in UNIX.
Most Unix system calls return Negative value on error.
The global variable errno Is set to a value for more information.
The file  < errno.h >  defines the variable errno.
The value of errno is not cleared,if an error does not occur.
The value of error is never set to 0 (zero).
Two functions to print error message
strerror( )
perror( ).
System Calls in UNIX Called service points for kernel service.
The system calls are one feature of UNIX That cannot change.
Unix version 7 has  50 system calls.
4.4 BSD  has 110system calls.
SVR4 has  120 system calls.

Header files of UNIX:
1)dirent.h   is for Directory entries
2)errno.h  is for Error codes
3)fcntl.h  is for File control
4)signal.h  is for Signals
5) stddef.h  is for  Standard definitions
6) stdio.h    is for Standard I/O 
7) string.h    is for string operations
8) time.h   is for time and date

Headers for IPC
9) sys/ipc.h  is for  IPC
10) sys/msg.h  is for  Message Queues
11) sys/sem.h  is for  Semaphores
12) sys/shm.h   is for Shared memory
13)sys/stat.h   is for file status
14)sys/times.h   is for Process times
15)sys/types.h  is for   Primitive system data types
16)sys/wait h   is for Process Control

What are the features of UNIX OS(operating system)?

1.Simple user interface.
2.Hierarchical file system.
3.Simple, Consistent interface to devices.
4.Protection of file data.
5.Peripheral devices treated as files.