UNIT – I
1. What are the different parts of UNIX system?
* Programs and services that have made the UNIX system environment.
* Operating system that supports those programs and services.
2. What are the features of UNIX os? (OR)
What are the reasons for popularity of UNIX operating system?
* The system is written in high level language, make it easy to read, understand,
change, and move to other machines.
* It has a simple user interface that has the power to provide the services that
* It provides primitives that permit complex programs to be built from simpler
* It uses a hierarchical file system, consistent format for files, byte stream,
* making application programs easier to write.
* It provide simple and consistent interface to peripheral devices.
* It is a multi user multi process system, it hides the machine architecture from
3. What is the purpose of system calls?
It instructs the kernel to do various operations for the calling program and
exchange data between the kernel and the program.
4. Write down the characteristics of UNIX file system?
* ?A hierarchical structure.
* ?Consistent treatment of file data.
* The ability to create and delete files.
* ?Dynamic growth of files.
* The protection of file data.
* The treatment of peripheral devices as files
5. Define path name and component.
A path name is a sequence of component names separated by slash characters; a
component is a sequence of characters that designates a file name that is uniquely
contained in the previous component.
6. What do you mean by access permissions?
Access permissions are set of bits associated with each file. Access permissions
can be set independently to control read, write, and execute permission for three classes of users: the file owner, a file group and every one else.
7. Define program and process.
A program is an executable file, and a process is an instance of the program in
8. What is the purpose of building block primitives?
Building block primitives enable users to write small, modular programs that
can be used as building blocks to build complex programs. Example for primitives is capability to redirect I/O.
9. What are the services provided by the kernel?
* Controlling the execution of processes by allowing their creation, termination or
* suspension and communication.
* Scheduling processes for execution on the CPU.
* Allocating main memory for an executing process.
* Allocating secondary memory for efficient storage and retrieval of user data.
* Allowing processes controlled access to peripheral devices.
10. What is the purpose of memory management?
Memory management module controls the allocation of memory. If at any time the system does not have enough memory for all processes the kernel moves them between main memory and secondary memory so that all processes get a fair chance to execute.
11. What is the job done by scheduler?
The scheduler module allocates the CPU to process. It schedules them to run in turn until they voluntarily relinquish the CPU while awaiting a resource until the kernel preempts them when their recent run time exceeds a time quantum. The scheduler then chooses a highest priority eligible process to run.
12. What do you mean by swapping?
UNIX system transfer processes from primary memory to swap device and from swap device to primary memory , but did not transfer parts of a process independently, except for a shared text. Such a memory management policy is called swapping.
13. List down the types of file
Regular file, Directory file, FIFO files, Character special file, Block special file,
socket file, symbolic file.
14. What are the different type of commands supported by shell?
* A command can be an executable file that contains object code produced by
* compilation of source code.
* A command can be executable file that contains a sequence of shell command lines.
* A command can be an internal shell command
15. Define shell programming.
It a command interpreter program that users typically execute after logging into system. The shell interprets the first word of command line as a command name. For many commands the shell forks and the child process execs a command associated with the name.
16. What are the execution modes of the user process?
There are two levels of user process ie, user and kernel. When a process executes
a system call the execution mode of the process changes from user mode to kernel mode.
17. What is the difference between user mode and kernel mode?
Processes in user mode can access their own instructions and data but not kernel
instructions and data. Processes in kernel mode can access kernel and user addresses.Some machine instructions are only privileged to kernel mode.
18. Define interrupts.
Interrupts are caused by events that are external to process. Interrupts are considered to happen between the execution of two instructions, and the system continueswith the next instruction after servicing the interrupt.
19. Define exception.
Exception refers to unexpected events caused by a process such as addressing
illegal memory, executing privileged instructions, division by zero and so on. Exception happens in the middle of the execution of an instruction and the system attempts to restart the instruction after handling the exception.
20. Write some sample processor execution levels?
* Machine errors
* Network devices
* Software interrupts
21. What are the different levels of operation in UNIX kernel?
User Level: The user programs and the libraries are available here.
Kernel level: This is the heart of UNIX operating system. All the operations related to file system, process control sub system,hardware control, and device drivers are available in this level.
Hardware level: The physical components of the system are available here.
22. What is the purpose of file sub system?
The file sub system accesses file data using a buffering mechanism that regulates
data flow between the kernel and secondary storage device.
23. What is the purpose of memory management?
Memory management module controls the allocation of memory. If at
any time the system does not have enough memory for all processes the kernel moves them between main memory and secondary memory so that all processes get a fair chance to execute.
24. Write down the purpose of buffering mechanism?
Buffering mechanism interacts with block I/O device drivers to initiate
data transfer to and from the kernel.
25. What is the job done by device drivers and block I/O devices?
Device drivers are the kernel modules that control the operation of peripheral
devices. Block I/O devices are random access storage devices.
26. What is the purpose of process control subsystem?
The process control subsystem is responsible for process synchronization, inter
process communications, memory management and process scheduling. The file
subsystem and process control subsystem interact when loading a file into memory for execution. The process control subsystem reads executable files into memory before executing them.
27. Write down the system calls useful for control the processes?
* fork: To create a new process
* exec: overlay the image of the program into the running process
* exit: to terminate a process
* wait: to introduce synchronization between the process.
* brk: control the size of the memory allocated to a process.
* signal: control process response to extraordinary events.
28. What are the data structures used for file processing?
It is a global data structure
User file descriptor table:
It is allocated per process
When a process opens or creats a file the kernel allocates an entry
fromeach table corresponds to the file inode.
Internal representation of file is given by an inode, which
contains a description of the disk layout of the file data and other
information related to permission, access time, owner etc.
29. Write about file system layout
Boot block : This occupies the beginning of a file system, typically
first sector,and may contain the bootstrap code
Super block: describes the state of the file system.
Inode list : A list of inodes that follows the super block in the file
Data blocks: Contain file data and administrative data.
30. Define process.
A process is the execution of a program and consists of a pattern of
bytes that the
CPU interprets as machine instructions, data, and stack.
31. What are the contents/ components of executable file?
* Set of headers that describes the attributes of the file.
* A program text.
* A machine language representation of data that has initial values when the program starts execution, and an indication of how much space the kernel should
allocate for uninitialized data.
* Symbol table information
32. What is the content of stack frame?
Stack frame contains the parameters to a function, its local variables, and the data necessary to recover the previous stack frame, including the value of program counter and stack pointer at the time of the program call.
33. What are the contents of user stack and kernel stack?
The user stack contains the arguments, local variables, and other data for functions executing in user mode. The kernel stack contains the stack frames for functions executing in kernel mode.
UNIT – II
34. What are the information available in inode?
A description about the disk addresses the file data and other information such as the file owner, file access permissions and access times.
35. Describe the contents in buffer cache.
The buffer consists of two parts: a memory array that contains data from the disk and a buffer header that identifies the buffer. The data in buffer corresponds to the data in a logical disk block and kernel identifies the buffer contents by examining identifier fields in the buffer header.
36. What are the information available in buffer header?
The buffer header contains a device number field and block number fields that specify the file system and block number of the data on disk and uniquely identify the buffer. It also contains a pointer to a data array, status field.
37. How will you identify the status of the buffer?
* The buffer is currently locked.
* The buffer contains valid data.
* The kernel must write buffer contents to disk before reassigning the buffer
* The kernel is currently reading or writing the contents of the buffer to disk.
* A process is currently waiting for the buffer to become free.
38. What are the different scenarios to allocate a buffer for a disk block.
* The kernel finds the block on its hash queue and its buffer cache.
* The kernel cannot find the block o the hash queue, so it allocates a buffer from the free list.
* The kernel cannot find the block o the hash queue and in attempting to allocate buffer from the free list, find a buffer on a free list that has been marked “delayed write”. The kernel must write the “delayed write” buffer to disk and allocate another buffer.
* The kernel cannot find the block o the hash queue, and the free list of buffers is empty.
* The kernel finds the block on the hash queue but its buffer is currently busy.
39. Write the data structures used for buffer pool.
* Doubly linked list
* Hash queue
40. Write the fields in disk inode.
* File owner Identifier
* File type
* File access functions
* File access times
* Number of links to the file
* Table of contents for the disk addresses
* File Size
41. Write the fields in incore inode.
The following fields in addition to the disk inode fields
* The status of in-core inode
* The logical device number
* Inode number
* Pointers to other in-core inodes
* Reference counts
42. What is the difference between incore inode and and buffer header.
Incode reference count which counts the number of active instances of the file.
43. Write the formula to find block number and byte offset.
The block number =((inode number – 1)/number of inodes per block)+start block of inode list
The byte offset= ((inode number-1)modulo(number of inodes per block))*size of disc inode
44. What is the use of iget and iput?
Iget: To get new inode number
Iput: To release the inode number
45. What are the entries in directory /directory layout.
* Byte offset in directory
* Inode number(2 bytes)
* File names
46. What is the use of namei algorithm.
To convert a path name to an inode
47. What are the fields in superblock.
* 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
* The size of the inode list
* The number of free inodes in the file system
* A list of free inodes in the file system
* The index of the next free inode in the free inode list
* Lock fields for the free block and the free inode lists
* A flag indicating that the super block has been modified
UNIT – III
48. What is the purpose of dup and mount system call?
The dup system call copies a file descriptor into the first free slot of the user file descriptor table, returning new file descriptor to the user.
The mount system call connects the file system in a specified section of a disk to the existing file system hierarchy.
49. What are the different types of pipes?
Unnamed pipe, and named pipe(FIFO)
50. How will you open and close the devices?
The devices are opened or closed by using the ordinary file functions open and close, because the devices are also treated as a file.
51. Write down the difference between named and unnamed pipes
named pipe is called by open system call
unnamed pipe is created by pipe system call
52. Write the system calls for accessing existing files.
Read, write, lseek,open
53. Write the system calls for creating new files.
54. Write the system calls that manipulate inode.
55. What are system calls that return file descriptors?
56. Write the syntax for create,open, read , write, close, link.
* Open: fd=open(pathname,flags,modes)
* Read: number=read(fd,buffer,count)
* Write: number=write(fd,buffer,count)
* Close: close(fd)
* Create: fd=creat(pathname,modes)
* Link: link(source filename,target filename)
57. What are the IO parameters saved in uarea.
58. Why file and records are locked?
To prevent other processes from reading or writing any part of an entire file or record.
59. What are the states in the lifetime of a process?
User Running, Kernal running, Ready to run, sleep, Ready to run and swapped, sleep and swapped, preempted, created, zombie
60. What is zombie state?
It is a final state of a process where the process no longer exists,but leaves a record containing an exit code and some timing statistics for its parent process to collect.
61. What is the size of uarea?
62. What are register triples?
There are 3 register triples namely kernel, data and uarea to have the pointers to kernel text,data,uarea of a process respectively.
63. Which command will move from user mode to kernel mode?
Trap system call
64. What are the algorithms used in saving context for abortive return?
65. What are the important fields in u area?
* ?Pointer to process table slot of the currently executing process
* Parameters of the current system call return values and error codes
* Internal I/O parameters
* ?Current directory and current root
* ?Process and file size limits
66. What are the factors affect the state of the process?
Text of the process, the values of its global user variables and data structures, the values of machine registers it uses, the values stored in its process table slot and u_area and the contents of its user and kernel stacks.
67. List down the fields in process table.
* State field
* ?Identifiers indicating the user who owns the process
* An event descriptor set when a process is suspended
68. Define context switch.
When the kernel decides to execute another process the kernel saves the necessary information so that it can later switch back to the first process and resume its execution.
69. Define process state and list down the different basic process states.
The lifetime of a process can be divided into a set of states, each with certain characteristics that describe the process. The basic process states are
* The process is currently executing in user mode.
* The process is currently executing in kernel mode .
* The process is not executing, but it is ready to run.
* The process is sleeping.
70. Define state transition diagram.
It is a directed graph whose nodes represent the states a process can enter and whose edges represent the events that cause a process to move from one state to another. State transitions are legal between two states if there exist an edge from the first state to the second.
71. What are the operations are carried out by kernel for fork system call?
* It allocates a slot in the process table for the new process.
* It assigns a unique ID number to the child process.
* It makes a logical copy of the context of the parent process.
* It increments file and inode table counters for files associated with the process.
* It returns the ID number of the child to the parent process, and a 0 value to the child process.
72. What are the different process states in UNIX?
The possible process states are
* ?User running
* ?Kernel running
* ?Ready to run in memory
* ?Asleep in memory
* ?Ready to run, but it is swapped process
* ?Sleep, but it is swapped
* ?Zombie state
73. What are the entries in process table?
State field, user identifiers, process identifiers, scheduling parameters, signal field, timer fields
74. What are the I/O parameters in U area?
I/O parameters in U area are
* Mode – indicates read and write
* Count – count of bytes to read and write
* Offset – byte offset in file
* Address – target address to copy data in user or kernel memory
* Flag – indicate a if address is in user or kernel memory
75. Write down the entries in u area.
A pointer to a process table, Real and effective user Ids, array for signals, timer fields, control terminal field, error field, return value field, I/O parameters, current directory, current root, user file descriptor, limit fields, permission modes field.
76. Define region.
System V divides the virtual address space of a process into logical divisions called regions. A region is a continuous area of the virtual address space of a process that can be treated as a distinct object to be shared or protected.
77. What are the components of register context?
The register context consists of the following components
* ?Program counter
* ?Processor status register
* ?Stack pointer
* ?General purpose registers
78. What are the components of system level context?
The system level context consists of the following components
* ?Process table entry of a process
* ?U area of a process
* ?Pregion entries
* Kernel stack
* ?Dynamic part of system level context
79. What are the operations during interrupt handling?
The kernel handles the interrupt with the following sequence of operations
* ?It saves the current register context and creates a new context layer.
* ?It determine the source of interrupt, type of interrupt and unit number
* ?Kernel invoke the interrupt handler
* ?Restore its previous context layer
80. Write down the steps for context switch.
Set of steps used for context switch are
* decide whether to do a context switch and whether a context switch is
* Save the context of old process
* Find the best process to schedule for execution
* Restore its context
81. Write down the contents of region table entry.
The contents in region table entries are
* A pointer to inode of the file
* ?Region type
* ?Size of region
* ?Location of region in physical memory
* ?Status of region – locked, demand, loaded into memory or valid in
* ?Reference count
82. What are the input needed for loading the region?
* Pointer to per process region table entry
* ?Virtual address to load region
* ?Inode pointer of file for loading region
* ?Byte offset in file for loading region
* ?Byte count for amount of data to load
83. What are the inputs needed for attaching a region?
* Pointer to region being attached
* Process to which region is being attached
* Virtual address in process where region will be attached
* Region type.
84. What are signals? Write the syntax for signal system call.
Signals inform processes of the occurrences of asynchronous events.
UNIT – V
85. Write down the process-scheduling algorithm.
Algorithm for process scheduling
Input and output are none
while(no process picked to execute)
for(every process on run queue)
pick highest priority process that is loaded in memory;
if (no process eligible to execute)
idle the machine;
remove chosen process from run queue;
switch context to that of chosen process, resume its execution.
86. What are the classes of process priorities?
User priorities and kernel priorities
87. What are the different process priority levels in kernel priorities?
Swapper, waiting for disk I/O, waiting for buffer, waiting for inode, waiting for tty input, waiting for tty output, waiting for child exit
88. Write down the principle of fair share scheduler.
This scheduler divides the user community into a set of fair share groups. The member of each group are subjects to the constraints of the regular process scheduler relative to other processes in the group. The system allocates its CPU time proportionally to each group regardless of how many processes are in the groups.
89. Define swap device
The memory management system monitors the amount of available primary memory and may periodically write processes to a secondary memory device called the swap device to provide more space in primary memory.
90. Define demand paging policy
The demand paging policy transferring memory pages instead of processes to and from a secondary device. The entire process does not have to reside in main memory to execute and the kernel loads pages for a process on demand when a process references the pages.
91. What do you mean by map?
The kernel maintains the free space for the swap device in an incore table called a map. Maps used for other resources besides the swap device allows a first fit allocation of contiguous blocks of a resource.
92. What do you mean by protection fault?
The process accessed a valid page but the permission bits associated with the page did not permit access. A process also incurs a protection fault when it attempts to write a page whose copy on write bit was set during the fork system call.
93. What are the different stages are specified as device configuration?
* Administrators can hard_code configuration data into files that are compiled and linked when building the kernel code
* Administrator can supply configuration information after the system is already running; the kernel updates internal configuration tables dynamically.
* Self identifying devices permit the kernel to recognize which devices are installed. The configuration procedure generates or fills in tables.
94. What are the different switch tables available in UNIX?
Block device switch table and character device switch table.
95. What is the purpose of icotl function?
It catch all entry point for device specific commands, allowing a process to setn hardware options associated with a device and software options associated with the driver.
96. What are the functions of line discipline?
* To parse input strings into lines
* To process erase characters
* To process a kill character
* To echo received character to a sequence of blank spaces.
* To generate signals to processes for terminal hang-ups, line breaks.
* To allow a raw mode that does not interpret special characters.
97. What do you mean by stream?
A stream is a full duplex connection between a process and a device driver. It consists of a set of linearly linked queue pairs, one member of each pair for input and other for output.
98. What do you mean by pseudo terminal or pty?
A pty is a software device that operates in pairs: output directed to one
member of the pair is sent to the input of the other member; input is sent to the upstream module.
99. What are the different methods available to identify the address?
The driver gets the address in two ways
* Either the strategy procedure uses a buffer from the buffer pool and the buffer header contains the device and block number or the read and write procedures are passed the minor number as a parameter.
* They convert the byte offset saved in the u area to the appropriate block address.
100. Define page stealer process.
The page stealer process is a kernel process that swaps out memory pages that are no longer part of the working set of a process.
101. What are the different types of page fault?
Validity faults and protection faults
102. When the validity fault occurs?
If a process attempts to access a page whose valid bit is not set it incurs a validity fault and the kernel invokes the validity fault handler.
103. Define page.
The memory management hardware divides physical memory into a set of equal sized blocks called pages.
104. What are the information available in page table entry?
The page table entries contain machine dependent information such as
permission bits to allow reading or writing of the page.
105. Write the states that cause the page fault.
* On a swap device and not in memory
* On the free page list in memory
* In an executable file
* Marked “demand zero”
* Marked “demand fill”
Descriptive questions and key
1. Explain in detail about the high level features of UNIX system
* List down the file system characteristics
* Explain in detail about the file system
* Explain about process control
* Explain about building block primitives.
2. Explain about UNIX system structure in detail.
Fig 1.1 -architecture of UNIX systems
3. Explain the architecture of UNIX operating system.
Draw the block diagram of system kernel
* Explain about process control subsystem
* Explain about file subsystem, buffer cache.
* Explain about IPC, scheduler, memory management
* Explain about drivers and interfaces.
4. Explain in detail about the processes
* Explain about process, process creation, process termination
* Explain basic process states
* Explain process state transition diagram
* Explain about context switch
5. Explain the assumptions about UNIX h/w in UNIX.
* Execution modes: user mode and kernel mode
* Interrupts and exceptions
* Processor execution levels
* Memory management
6. Discuss about system concepts in UNIX
* File system
* Process system
7. Discuss about the structure of buffer pool. Write the advantages and disadvantages of buffer cache.
* It allows uniform disk access
* It makes user programs simpler and more portable
* It reduces the amount of disk traffic
* It ensures file system integrity
* It requires an extra data copy when reading and writing to and from user processes
* If too much memory is used for buffers,the system will slow down
8. Explain the scenarios for retrieval of a buffer.
* List down the different scenarios for retrieval a buffer
* Explain each scenario with diagram.
* Explain the algorithms getblk, brelse, bread, bwrite, breada
* Advantages and disadvantages of the buffer cache
9. Write the algorithm of allocating incore inode.
10. Which algorithm is used to convert a path name to an inode? Explain.
11. What is Pipe? What the different types of pipes? Write difference between regular file and pipe?
Pipe allows transfer of data between processes in a FIFO manner
Regular file uses direct and indirect inode blocks.
Pipe uses only direct inode blocks
12. What is the use of dup system call? Write the algorithm of dup system call.
USE: It copies a file descriptor into the free slot of the user file descriptor table
13. Can two files have the same inode? If so, specify the system call and its algorithm.
* Yes, dup and its algorithm
14. What system call allows another file system to be attached to your file system? What is the attachment point? What table maintains all these information?
* Mount system call
* Mount point
* Mount table
15. What are the entries in mount table? What are the data structures used for mount system call?
* Pointer to a buffer containing the file system super block
* A pointer to the root inode of the mounted file system
* A pointer to the inode of the directory( mount point)
1. Inode table
2. Mount table
16. What are the operations carried out during unmounting the file system?
17. Explain the system calls that return file descriptors as output
Explain the following system calls with the necessary algorithms and example
18. Explain the functions related to file I/O
Explain the following functions in detail with algorithm
19. Explain in detail about pipes
* Explain about pipe system call
* Explain about opening a named pipe
* Explain about reading and writing pipes
* Explain about closing pipes with example
20. What are the process states and explain the process state transition diagram.
* Nine process states
* Process state transition diagram and explanation
21. Write the fields in process table and uarea.
State field,User identifiers,Process identifiers,Event descriptor,Scheduling parameters,Signal fields,Various timers
A pointer to the process table,timer fields,an array for signals,error field, IO parameters,curret directory,user file descriptor table,limit field,permission modes
22. Explain the layout of the system memory.
* Pages and page tables
* Layout of the kernel
23. Explain the manipulation of the process address space
Explain the following
* Locking and unlocking a region
* Allocating a region with algorithm
* Attaching a region to a process with algorithm
* Changing the size of region with algorithm
* Loading a region freeing a region
* Freeing a region
* Detaching a region from process
* Duplicating a region
24. What is the context of a process? Explain.
System level context
25. Explain about saving the context of a process?
* Interrupts and exceptions
* System call interface
* Context switch
* Saving context for abortive returns
* Copying data between system and user address space
26. Explain in detail about process scheduling
Explain the following
* System configuration
* System calls and driver interface
* Open and closing device files
* Read and write operations
* Strategy interface
* ioctl function
* Interrupt handlers
27. Explain in detail about swapping
* Explain about allocation of swap space
* Explain in detail about swapping processes out
* Explain fork swap and expansion swap
* Explain swapping processes in with algorithm
28. Explain in detail about demand paging
* Explain in detail about data structures for demand paging
* Explain fork and exec in a paging system
* Explain page stealer process
29. Explain in detail about page fault and fault handlers
* Define page fault
* Explain validity fault handler with algorithm
* Explain protection fault handler with algorithm
30. Explain in detail about the driver interfaces
* System configuration
* System calls and driver interface
* xplain about open and close a device
* Explain about read and write a device
* Explain about ioctl function
31. Explain in detail about terminal drivers
* Define terminal drivers
* List down the functions of line discipline
* Explain about clists
* Explain the terminal driver in canonical mode
* Explain the terminal driver in raw mode
* Explain in detail about terminal polling and logging in