Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

OS question

  1. Sep 26, 2005 #1
    Code (Text):
    The control program for a device-driver process is an infinite loop.
    Roughly, the loop body is: wait for I/O request from user process; send
    I/O command to device; wait for command completion; notify (unblock) user

        a) [10 marks] Suppose the device driver waits by polling the device for
        command completion.  How does this affect multiprogramming?

        b) [10 marks] Assume there is a timer interrupt 60 times a second.  Can
        you find a reasonable solution for waiting that does not use device
        interrupts?  If you find one, describe it.

    Help please !
  2. jcsd
  3. Sep 26, 2005 #2


    User Avatar
    Staff Emeritus

    Ok, so where is your attempt at solving the problem?
  4. Sep 17, 2007 #3


    User Avatar

    What does "how does this affect multiprogramming" mean?

    Hi Ho! :smile:

    I know that multiprogramming is a technique of loading several programs into the main memory at once so that when one program is waiting for the I/O process to finish, the CPU can be kept busy by executing another program.

    So, I wonder in what way the I/O process is going to affect multiprogramming because as far as I know there is no correlation between the number of programs that can be loaded into the main memory and the time a program must wait for the I/O process to finish.

    I also have a similar question like that, which is "if a computer does not employ DMA, the CPU must take care the transfer of data from an I/O device to the memory, or from the memory to an I/O device. So, how does this affect multiprogramming?"

    I think multiprogramming will be affected in a way that there is no good reason of loading too many programs into the main memory if DMA is not employed, since with a small amount of programs in the main memory, the CPU will be busy enough.

    What do you think?

  5. Sep 17, 2007 #4
    Hey Eus..

    Excuse me for wondering if you ever heard of multi threading...?

    How is this really any different ?

    Please explain.


  6. Sep 18, 2007 #5


    User Avatar

    Hi Ho! :smile:

    Thread is a light-weight process because it uses the same address space (core image) of the instantiating process.

    Creating a process is a much expensive business since a process must have its own address space (program text, data, and stack), whereas a thread shares its parent's data, and perhaps, program text.

    So, multi-threading is a technique of instantiating many threads from a program (the parent process) to tackle a big job in such a way that does not exhaust the main memory but keeps the CPU busy all the time.

    For example, if you do a recursive quick sort like:

    sort (0, middle);
    sort (middle+1, end);

    the first function that you call to sort [0, middle] must return first before the function to sort the rest will work.

    But, if you employ multi-threading like:

    threadSort (0, middle).start; // 1
    threadSort (middle+1, end).start; // 2

    both of the "functions" will work in turn like:
    1 1 1 1 2 2 2 2 1 2 2 1 1 2 2 1 ....

    So, generally multi-threading employs multi-programming in a way that each thread can maintain its own local variables in the main memory so that the CPU can execute one of the thread in case the CPU is idle.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: OS question
  1. Software and os (Replies: 1)

  2. OS question (Replies: 2)

  3. OS help (Replies: 6)

  4. Quick OS X Question (Replies: 1)

  5. Vista OS (Replies: 21)