OS question

  • #1

Main Question or Discussion Point

Code:
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
process.

    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 !
 

Answers and Replies

  • #2
dduardo
Staff Emeritus
1,898
3
Ok, so where is your attempt at solving the problem?
 
  • #3
Eus
94
0
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?

Regards,
Eus
 
  • #4
49
0
Hey Eus..

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

How is this really any different ?

Please explain.

Respectfully.

Aquafire
 
  • #5
Eus
94
0
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.

Regards,
Eus
 

Related Threads for: OS question

  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
12
Views
3K
  • Poll
  • Last Post
2
Replies
41
Views
4K
  • Last Post
Replies
21
Views
4K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
13
Views
3K
Top