UNIX system

 

 

 

UNIX system

 

The following texts are the property of their respective authors and we thank them for giving us the opportunity to share for free to students, teachers and users of the Web their texts will used only for illustrative educational and scientific purposes only.

 

All the information in our site are given for nonprofit educational purposes

The information of medicine and health contained in the site are of a general nature and purpose which is purely informative and for this reason may not replace in any case, the council of a doctor or a qualified entity legally to the profession.

 

 

UNIX system

 

  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.
  1. What are the goals of Multics system?

To provide simultaneous access to a large community of users, to supply ample computation power and data storage, and to allow users to share their data easily, if desired.

  1. 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 users want.
      • It provides primitives that permit complex programs to be built from simpler programs.
      • 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 user.

 

  1. 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.

  1. 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

 

  1. 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.

  1. 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.

  1. Define program and process.

                A program is an executable file, and a process is an instance of the program in execution.

  1. 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.

  1.  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.

 

  1. 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.

  1. 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.

  1. What do you mean by swapping?

            UNIX system transferred entire processes between primary memory and swap device, but did not transfer parts of a process independently, except for a shared text. Such a memory management policy is called swapping

  1. List down the types of file

             Regular file, Directory file, FIFO files, Character special file, Block special file, socket file, symbolic file.

  1. 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

 

  1. 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.

  1. What are the execution modes of the user process? Define that.

             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.

  1. 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.

  1. 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 continues with the next instruction after servicing the interrupt.

  1. Define exception.

           Exception refers to unexpected events caused by a process such as addressing illegal memory, executing privileged instructions, dividing by zero and so on. Exception happen in the middle of the execution of an instruction and the system attempts to restart the instruction after handling the exception.

  1.  Write some sample processor execution levels?

          Machine errors
Clock
Disk
Network devices
Terminals
Software interrupts

  1. What are the different communications supported by UNIX?

                Inter process communication and network communication

  1. What do you mean by Inter process communication?

            UNIX operating system supports multiple processes simultaneously. The communications between these processes are referred as Inter process communication.

  1. What are the different inter process communication methods supported by UNIX V

             Message Queues
Named and unnamed pipes
Share memory
Semaphore

  1. 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.

  1. What are the central concepts of UNIX system?

                 The entities files and processes are referred as central concepts of UNIX.

  1. 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.

  • 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.

  • 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.

  • 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.

  • 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

  • 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.

  • 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.

  • What are the data structures used for file processing?

             File table: 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 from each table corresponds to the file inode.
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.

  • 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 system.
Data blocks: Contain file data and administrative data.

  • 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.

  • What are the contents 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
  •  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 suspende
  1. What are the information available in inode?

                  A descriptor of the disk layout of the file data and other information such as the file owner, file access permissions and access times.

  1. Define the components of file system.
    • Boot block: This block occupies the beginning of the file system, typically the first sector, and may contain the bootstrap code.
    • Super block: describes the state of file system- how large it is, how many files it can store, where to find free space on the file system and other information.
    • Inode list: List of inodes.
    • Data block: This block contains file data and administrative data.

 

  1. Define process.

                 A process is the execution of the program and consists of the pattern of bytes that the CPU interrupts as machine instructions, data, and stack.

  1. What are the components of executable file?
    • Set of a headers that describe the attributes of file.
    • The 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 uninitiallized data
    • Other sections such as symbol table information.

 

  1. 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.

  1. 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.

  1. 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

 

  1. 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.

  1. 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.

  1. 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
i. 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.
  1. 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.

  1. 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.

  1. What is 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.

  1. 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.

 

  1. 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.

51. Write down the difference between named and unnamed pipes
A major difference between theses IPC mechanism is the related processes are allowed to communicate using unnamed pipes but the unrelated processes are also communicate in named pipes.

  1. What is the purpose of debugger process?

                A debugger process spawns a process to be traced and controls its   execution  with the ptrace system call , setting and clearing break points, and reading and writing data in its virtual address space.

  •  What  are the jobs done by process tracing?
      • Synchronization of the debugger process and the traced process.
      • Controlling the execution of traced process.

 

54. Write down the structure of debugging process.
if ((pid = fork() ) = = 0)
{    /* child – traced process */
ptrace(0,0,0,0);
exec(“name of traced process here”);
}
/* debugger process continues here */
for ( ; ;)
{
wait((int *) 0);
read(input for tracing instructions);
ptrace(cmd,pid,…);
if (quitting trace)         
break;
}

  • List down the drawbacks of ptrace function.
      • The kernel must do four context switches to transfer a word of data between a debugger and a traced process.
      • A debugger can only trace child processes. If the traced child forks the debugger has no control over the grandchild.
      • A debugger cannot trace processes that is already executing if the debugged process had not called ptrace to let the kernel know that it consents to be traced.
      • It is impossible to trace setuid function, because the users could violate security by writing their address space via ptrace and doing illegal operations.

 

  • What are the advantages of ptrace function introduces by Killian?
      • It is faster than orinary ptrace function.
      • A debugger can trace arbitrary processes.
      • The traced process does not have to make prior arrangement to allow tracing.
  • What the Inter process communication mechanisms available in System V?
      •  Messages allow processes to send formatted data streams to arbitrary processes.
      • Shared memory allows processes to share parts of their virtual address space.
      • Semaphores allow processes to synchronize execution.

 

  • List down the common properties of system V IPC.
      • Each mechanism contains a table whose entries describe all instances of the mechanism.
      • Each entry contains a numeric  key.
      • Each mechanism contains “get” system call to create a new entry or to retrieve an existing entry.
      • The kernel uses the following formula to find the index into the table

                 Index  = descriptor modulo (number of entries in table)

      • Each IPC entry has a permission structure that includes the user ID and group ID, read_write_execute permissions for owner, group and others.
      • Each entry contains other status information like time of last access or update etc.
      • Each mechanism contains a control system call to query status of an entry, to set status information or to remove the entry from the system.
  • What are the system calls related to message queues?
      • msgget returns a message descriptor that designates a message queue for use in other system calls.
      • msgctl has options to set and return parameters associated with a message descriptor and an option to remove descriptors.
      • msgsnd sends a message
      • msgrcv receives a message.

 

  1. 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
  • Preempted
  • Created
  • Zombie state
  1. What are the entries in process table?

State field, user identifiers, process identifiers, scheduling parameters, signal field, timer fields

  1. 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

  1. 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.

 

  1. 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.

 

  1. 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
  1. 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
  1. 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
  1. 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 permissible now.
      • Save the context of old process
      • Find the best process to schedule for execution
      • Restore its context
  1. 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 memory
        • Reference count
  1. What are the operations done by the kernel during fork function?

The operations during fork function are

      • Its allocate a slot in process table for the new process
      • It assign a unique ID number
      • It makes the logical copy of the context of the parent process
      • It increments the file and inode table counters for files associated with the process
      • It returns the Id of a child to parent and 0 in child process
  1.  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.
}

  1. What are the classes of process priorities?

User priorities and kernel priorities

  1. 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

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. What are the different stage are specified ad 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.

 

  1.  What are the different switch tables available in UNIX?

Block device switch table and character device switch table.

  1. What is the purpose of icotl function?

It catch all entry point for device specific commands, allowing a process to set hardware options associated with a device and software options associated with the driver.

  1. 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.

 

  1. 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.

  1. 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.

  1. 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

 

  1. 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 blok address.
  1. What do you mean by shared memory?

Processes can communicate directly with each other by sharing parts of their virtual address space and then reading and writing the data stored in the shared memory.

  1. What are the elements of system V semaphore?
        • A value of a semaphore
        • The process ID of the last process to manipulate the semaphore
        • The number of processes waiting for the semaphore value to increase
        • The number of processes waiting for the semaphore value equal to 0

 

  1. What is the format of each element of oplist?
    • The semaphore number identifying the semaphore array entry being operated on
    • The operation and flags
  1. What are the different types of page fault?

Validity faults and protection faults

  1. 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.

  1. 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.

 

  1. 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.

  1. Write down the algorithm for process scheduling.

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.
}

  1. Define page.

The memory management hardware divides physical memory into a set of equal sized blocks called pages.

  1. 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.

  1. What are the different types of pipes?

Unnamed pipe, and named pipe(FIFO)

  1. 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.

  1. What is the difference between close and shutdown?

In socket communication the close function closes both the connections. The shutdown function closes only the required connection.

100.Write down the system calls used for TCP communication.
socket, bind, listen, accept, connect,send, recv, close.

 

Source : http://www.niceindia.com/qbank/unix_internals.doc

Web site link to visit: http://www.niceindia.com/

Google key word : UNIX system file type : doc

Author : not indicated on the source document of the above text

If you are the author of the text above and you not agree to share your knowledge for teaching, research, scholarship (for fair use as indicated in the United States copyrigh low) please send us an e-mail and we will remove your text quickly.

 

UNIX system

 

If you want to quickly find the pages about a particular topic as UNIX system use the following search engine:

 

 

UNIX system

 

Please visit our home page

 

Larapedia.com Terms of service and privacy page

 

 

 

UNIX system