OS interview questions

  1. What is MUTEX ?
  2. What isthe difference between a ‘thread’ and a ‘process’?
  3. What is INODE?
  4. Explain the working of Virtual Memory.
  5. How does Windows NT supports Multitasking?
  6. Explain the Unix Kernel.
  7. What is Concurrency? Expain with example Deadlock and Starvation.
  8. What are your solution strategies for “Dining Philosophers Problem” ?
  9. Explain Memory Partitioning, Paging, Segmentation.
  10. Explain Scheduling.
  11. Operating System Security.
  12. What is Semaphore?
  13. Explain the following file systems : NTFS, Macintosh(HPFS), FAT .
  14. What are the different process states?
  15. What is Marshalling?
  16. Define and explain COM?
  17. What is Marshalling?
  18. Difference - Loading and Linking ?
This entry was posted in General, Unix/Linux, Windows. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

36 Comments on OS interview questions

  1. Nikesh Gupta
    Posted 10/18/2005 at 4:12 am | Permalink

    Q1. What is mutex?

    Ans: - Mutex is a program object that allows multiple program threads to share the same resource, such as file access, but not simultaneously. When a program is started a mutex is created woth a unique name. After this stage, any thread that needs the resource must lock the mutex from other threads while it is using the resource. the mutex is set to unlock when the data is no longer needed or the routine is finished.

  2. Nikesh Gupta
    Posted 10/18/2005 at 4:18 am | Permalink

    Q2. What isthe difference between a ‘thread’ and a ‘process’?

    Ans. A process is a collection of virtual memory space, code, data, and system resources. A thread is code that is to be serially executed within a process. A processor executes threads, not processes, so each application has at least one process, and a process always has at least one thread of execution, known as the primary thread. A process can have multiple threads in addition to the primary thread. Prior to the introduction of multiple threads of execution, applications were all designed to run on a single thread of execution.

    When a thread begins to execute, it continues until it is killed or until it is interrupted by a thread with higher priority (by a user action or the kernel’s thread scheduler). Each thread can run separate sections of code, or multiple threads can execute the same section of code. Threads executing the same block of code maintain separate stacks. Each thread in a process shares that process’s global variables and resources.

  3. daniel
    Posted 10/25/2005 at 6:37 am | Permalink

    What isthe difference between ‘convenient’ and ‘efficient’?

  4. Naveen
    Posted 11/7/2005 at 8:05 pm | Permalink

    Q12: What is Semaphore?
    Ans: Locking Mechanism used inside resource mangers and resourse dispensers.

  5. Naveen
    Posted 11/7/2005 at 8:10 pm | Permalink

    15Q: What is Marshalling?
    Ans: The process of packaging and sending interface method parameters across thread or process boundaries.

  6. Naveen
    Posted 11/7/2005 at 8:26 pm | Permalink

    Q16:Define and Explain COM?
    Ans: COM is a specification(Standards). COM has two aspects
    a: COM specifications provide a definition for what object is
    b: COM provides services or blue prints for creation of object and comminication between client and server.
    COM is loaded when the first object of the component is created.

  7. elumalai
    Posted 1/27/2006 at 8:36 am | Permalink

    #14.A process may be in anyone of the following states

  8. Shrinidhi Karanth
    Posted 3/4/2006 at 1:09 am | Permalink

    Answer to Question:
    What isthe difference between ‘convenient’ and ‘efficient’?

    Convenient programming is the way of programming using the available resources like Library APIs, Macros etc without caring for efficiency.
    Let me explain this with an example. Suppose we need to convert a character into an upper case, only if the character is an alphabet in lower case.
    A convinient way of achieving this is as follows

    if( isalpha(ch) )
    ch = toupper(ch);

    However, the overhead with this is as follows
    1. Involves the use of ctype.h library and
    2. Takes high MIPS (million instructions per second) since it involves function calls.

    An efficient way to this is as follows

    if( ‘a’

  9. Posted 3/12/2006 at 11:33 pm | Permalink

    I need all the details on UNIX operating system interview questions.
    kindly send me, for which I will be greatful to you.
    Thanking you.

  10. Jane Ping
    Posted 4/7/2006 at 4:38 pm | Permalink

    Can someone share some inforamation about Unix interview preparision? like what kind of books which website is better?

  11. CC
    Posted 8/27/2006 at 8:09 pm | Permalink

    Other questions for UNIX / Linux Admin at major internet company:

    What port is SSH?
    What port is DNS? Is it UDP or TCP?
    What does it mean to “setuid”?

  12. Gautam.N.Pai
    Posted 10/12/2006 at 6:52 am | Permalink

    Answer to Question 3

    Data structures that contain information about the files that are created when unix file systems are created.Each file has an i-node & is identified by an inode number(i-number) in the file system where it resides.inode provides important information on files such as group ownership,acess mode(read,write,execute permissions).

  13. vimalan.m
    Posted 11/3/2006 at 8:26 am | Permalink

    I need ans 4 all these question.
    1.What is the main differents b/w vx-works and liunux os?
    2.how to interface 8051 microcontroller with 2 mb ram?
    4.What is gobel variable in c?

  14. Posted 11/11/2006 at 2:24 am | Permalink

    elumalai said,

    #14.A process may be in anyone of the following states

    # –> TERMINATE is not a state, if the process “TERMINATE” it even exists

  15. Mamtha
    Posted 11/13/2006 at 7:29 pm | Permalink

    What is the difference between a MUTEX and a binary semaphore?

  16. Satyanarayana
    Posted 12/21/2006 at 9:21 am | Permalink

    1.What is the main differents b/w vx-works and liunux os?

    Ans) Vx-works is real time operation system

    LINUX is general OS , also can be confugured for RTOS

    4.What is gobel variable in c?
    Ans) Any variable declared out side the function is global variable. Static global variables scope is limited to file.

  17. Raj
    Posted 1/14/2007 at 2:54 pm | Permalink

    VxWorks is embedded OS while Linux OS is gereric OS, main difference is as :
    1. If change the sceduling of one process from A to B then the others task have no effect in linux but in VxWorks all task’s scheduling change to B, i.e. in VxWorks all the task have same scheduling but in linux it can different.
    In Vxworks you can access any memory location(should be exist), but in linux you can access only the segment which have allocated for that process.

  18. afenz
    Posted 1/22/2007 at 10:37 pm | Permalink

    can you explain how process are managed on WindowsTMXP/UNIX

    Hint: WindowsTMXP (ctrl+alt+del), UNIX (ps, kill, nice, bg, fg)

  19. Ratheesh
    Posted 2/18/2007 at 11:28 pm | Permalink

    The process of gathering data and transforming it into a standard format before it is transmitted over a network so that the data can transcend network boundaries. In order for an object to be moved around a network, it must be converted into a data stream that corresponds with the packet structure of the network transfer protocol. This conversion is known as data marshalling. Data pieces are collected in a message buffer before they are marshaled. When the data is transmitted, the receiving computer converts the marshaled data back into an object.

  20. Ratheesh
    Posted 2/18/2007 at 11:33 pm | Permalink

    hi mamtha,

    A mutex is owned by a thread/process. So once a thread locks it, then other threads/processes will either spin or block on the mutex. Whereas, semaphore allows one or more threads/processes to share the resource.

  21. snark
    Posted 2/28/2007 at 1:57 am | Permalink

    difference between linking and loading:

    Linking: Resolving unresolved references to code.

    Loading: Actually loading program to memory (allocating addresses to segments).

  22. Prasad Talekar
    Posted 3/23/2007 at 4:42 am | Permalink

    What is Mutex Object?
    Ans:- A mutex object is a synchronization object whose state is set to signaled when it is not owned by any thread, and non-signaled when it is owned. For example, to prevent two threads from writing to shared memory at the same time, each thread waits for ownership of a mutex object before executing the code that accesses the memory. After writing to the shared memory, the thread releases the mutex object.

  23. Prasad Talekar
    Posted 3/23/2007 at 4:43 am | Permalink

    What is semaphore?

    Ans:- A semaphore object is a synchronization object that maintains a count between zero and a specified maximum value. The count is decremented each time a thread completes a wait for the semaphore object and incremented each time a thread releases the semaphore. When the count reaches zero, no more threads can successfully wait for the semaphore object state to become signaled. The state of a semaphore is set to signaled when its count is greater than zero, and non-signaled when its count is zero. The semaphore object is useful in controlling a shared resource that can support a limited number of users. It acts as a gate that limits the number of threads sharing the resource to a specified maximum number.

  24. Dex
    Posted 4/2/2007 at 6:49 am | Permalink

    I have came through an Example explaining Mutex and Semaphore
    1. Serial access
    one toilet is available with a Key for it.one guy will have the key and will use the toilet, so making others to wait for access.once done, he gives the key to the other
    2. Mutex is semaphore of value 1

    1. N resources access
    say for example 4 toilets are there; each has a common key for the toliets available.at the start semaphore value set to 4(4 toilets are free), once any user gets in ; semaphore decrements the value;
    once done he will increment saying it ; it’s FREE…

  25. What is Mutex and Semaphore...???
    Posted 5/8/2007 at 2:18 am | Permalink

    Mutex :

    Mutex is the synchronized object used to achive serialized resource access i.e. one by one to single resource.
    eg : In an interview, only one person can interview a candidate, after his completion one more person will come & interview the same candidate.


    Semaphore is the synchronized object used to achive serialized resource access i.e. one by one to the N number of resource.

    eg : In an interview, one person is interview 2 or more candidates sewuentially, after his completion one more person will come & interview the same candidates.

  26. sheikhsikkandar
    Posted 6/7/2007 at 3:55 am | Permalink

    What is INODE?
    ans:It contains information about UNIX file system.ie when the file can be created and also gives the owership of the file,and permission level.inode number (i-number) is reside over the files,it can be found using the command ls-l

  27. sheethal Gunjal
    Posted 6/24/2007 at 3:49 am | Permalink

    Waht is the difference b/w shared memory & message queues ?
    I know few differences.Can anyone tell me few more?

    1.System call overhead in case of message queue.
    2.Shared memory is fastest IPC mechanism, since it doesn’t involve any system call as it is done in user space.
    3.once data read from message queue, the data is gone in case os message queue whereas in shared memory, tha data will be there.

  28. Krishna Pradeep
    Posted 6/25/2007 at 4:20 pm | Permalink

    What is the difference between a MUTEX and a binary semaphore?
    Ans: A binary Semaphore and mutex are one and the same.A binary semaphore has different types like counting semaphore,binary semaphore.Let me put in this way a mutex is a semaphore with count as 1 that means synchronization is achived to process/thread for the resource in one by one manner

  29. Krishna Pradeep
    Posted 6/26/2007 at 12:37 pm | Permalink

    The difference between an ordinary binary semaphore and a mutex semaphore is in the way the semaphore is initialized.
    For an ordinary binary semaphore, a task attempting to synchronize to an external event creates an empty semaphore. When it reaches the point to be synchronized, it attempts to take a semaphore. If unavailable, it waits at this point. A second task which controls the synchronization event gives the semaphore when it is no longer needed. The first task receives notification that the semaphore is available and proceeds.
    For a mutex semaphore, a task wishing to block other tasks from a resouce first creates a full semaphore, and then takes the semaphore, making it unavailable to other tasks. When it is no longer needed, it the task gives the semaphore, making the resource available. A mutual exclusion semaphore must have matching “takes” and “gives”.

  30. sarthak jain
    Posted 7/20/2007 at 10:18 am | Permalink

    ques what is the diff between a mutex and a binary semaphore?
    Ans : Mutex and binary semaphore(semaphore with value 1) are exactly one and the same thing.

  31. dinesh
    Posted 8/12/2007 at 10:29 am | Permalink

    mutex and binary semaphore are not the same. When a mutex is locked by a thread, the same thread has to release it; it cannot be released by other thread. When a binary semaphore is locked, the other thread can release it and then lock it again.

  32. bibek4u
    Posted 10/9/2007 at 9:05 am | Permalink

    Mutual-exclusion semaphores can be taken recursively. This means that the semaphore can be taken more than once by the task that holds it before finally being released.

  33. Pankaj
    Posted 5/29/2008 at 8:11 am | Permalink

    Hi Raj,

    Linux doesn’t have segmented process address space. it it just continuous, include kernel and user space area. We can refer that Proces has access to it’s address space only.

    Just posting for the clarification on your remarks.

    I know, semaphores have a characteristics that another thread can unlock. Still I remember I read somewhere that Binary semaphores and Mutex are same.

    Semaphores exist in many variants, though usually the term refers to a counting semaphore, since a binary semaphore is better known as a mutex. A counting semaphore is a counter for a set of available resources, rather than a locked/unlocked flag of a single resource. It was invented by Edsger Dijkstra. Semaphores are the classic solution to preventing race conditions in the dining philosophers problem, although they do not prevent resource deadlocks.

    - Pankaj

  34. Pankaj
    Posted 5/29/2008 at 8:27 am | Permalink

    Explain Scheduling.

    Every operating system use a mechanism to execute processes. it maintains a run queue which actually sort process and keep them on the execution order and they wait for their turn.

    Actually, in normal cases, our operating systems use Priority And Round Robin Mechanism.

    - Pankaj

  35. Pankaj
    Posted 5/29/2008 at 8:35 am | Permalink

    Explain Memory Partitioning, Paging, Segmentation.

    Memory partitioning is the way to distribute the Kernel and User Space Area in Memory.

    Paging is actually a minimum memory, that can be swap in and swap out from Memory.
    In modern Server operating systems, we can use Multiple page size support. That actually helps to tune OS performance, depending on type of applications.

    Segmentation is actually a way to keep similar objects in one place. For example: you can have your stack stuffs in one place (Stack Segment), Binary code in another place(text segment), data in another place (Data and BSS segment).

    Linux doesn’t have segment architecture. AIX has a Segment architecture.

    - Pankaj

  36. Pankaj
    Posted 5/29/2008 at 8:39 am | Permalink

    What are your solution strategies for “Dining Philosophers Problem” ?

    One line solution is:

    don’t lock any resources, if you can not complete your process with the available resources.

    if a philosopher will not hold a chopstick until both the chopsticks are available there.

    I thinks, this concept runs on all our Operating systems.

    - Pankaj

Post a Comment

Your email is never published nor shared. Required fields are marked *