Sample Questions Best site for GRE, LSAT, SAT, GMAT, TOEFL, CCNA, CCSA and interview sample questions  

Technical Sample Questions : C |  C++ |  Oracle |  Java | Unix |  Operating Systems |  Data Structure

Sample Technical Questions

Unix Sample Questions

Questions on Process model and IPC in uinx

  1. List the system calls used for process management:

    Answer:


    System calls Description
    fork() To create a new process
    exec() To execute a new program in a process
    wait() To wait until a created process completes its execution
    exit() To exit from a process execution
    getpid() To get a process identifier of the current process
    getppid() To get parent process identifier
    nice() To bias the existing priority of a process
    brk() To increase/decrease the data segment size of a process
  2. How can you get/set an environment variable from a program?

    Answer:

    Getting the value of an environment variable is done by using 'getenv()'.
    Setting the value of an environment variable is done by using 'putenv()'.
  3. How can a parent and child process communicate?

    Answer:

    A parent and child can communicate through any of the normal inter-process communication schemes (pipes, sockets, message queues, shared memory), but also have some special ways to communicate that take advantage of their relationship as a parent and child. One of the most obvious is that the parent can get the exit status of the child.
  4. What is a zombie?

    Answer:

    When a program forks and the child finishes before the parent, the kernel still keeps some of its information about the child in case the parent might need it - for example, the parent may need to check the child's exit status. To be able to get this information, the parent calls 'wait()'; In the interval between the child terminating and the parent calling 'wait()', the child is said to be a 'zombie' (If you do 'ps', the child will have a 'Z' in its status field to indicate this.)
  5. What are the process states in Unix?

    Answer:

    As a process executes it changes state according to its circumstances. Unix processes have the following states:
    Running : The process is either running or it is ready to run .
    Waiting : The process is waiting for an event or for a resource.
    Stopped : The process has been stopped, usually by receiving a signal.
    Zombie : The process is dead but have not been removed from the process table.
  6. What Happens when you execute a program?

    Answer:

    When you execute a program on your UNIX system, the system creates a special environment for that program. This environment contains everything needed for the system to run the program as if no other program were running on the system. Each process has process context, which is everything that is unique about the state of the program you are currently running. Every time you execute a program the UNIX system does a fork, which performs a series of operations to create a process context and then execute your program in that context. The steps include the following: Allocate a slot in the process table, a list of currently running programs kept by UNIX. Assign a unique process identifier (PID) to the process. iCopy the context of the parent, the process that requested the spawning of the new process. Return the new PID to the parent process. This enables the parent process to examine or control the process directly.
    After the fork is complete, UNIX runs your program.
  7. What Happens when you execute a command?

    Answer:

    When you enter 'ls' command to look at the contents of your current working directory, UNIX does a series of things to create an environment for ls and the run it: The shell has UNIX perform a fork. This creates a new process that the shell will use to run the ls program. The shell has UNIX perform an exec of the ls program. This replaces the shell program and data with the program and data for ls and then starts running that new program. The ls program is loaded into the new process context, replacing the text and data of the shell. The ls program performs its task, listing the contents of the current directory.

« Previous || Next »

Unix Sample Question Number : 1-5 | 6-11 | 12-16 | 17-23 | 24-29 | 30-36 | 37-41 | 42-48 | 49-55 | 56-61 | 62-67 | 68-73
Sample Test Questions
GRE Sample Questions
CAT Sample Questions
GMAT Sample Questions
TOEFL Sample Questions
ACT Sample Questions
SAT Sample Questions
LSAT Sample Questions
PSAT Sample Questions
MCAT Sample Questions
PMP Sample Questions
GED Sample Questions
ECDL Sample Questions
DMV Sample Questions
CCNA Sample Questions
MCSE Sample Questions
Network+ Sample Questions
A+ Sample Questions
Technical Sample Questions
WASL Sample Questions
CISA Sample Questions

Other Sample Questions
Sample Interview Questions
Sample Teacher Interview Questions
Sample Citizenship Questions
Accuplacer Sample Questions
Science Bowl sample Questions
Driving Test Sample Questions
Sample Survey Questions Sample Essay Questions
Sample Behavioral Interview Questions

Copyright © 2004-2013, Best BSQ. All Rights Reserved.