[algogeeks] Re: sleep

2010-06-12 Thread souravsain
@sharad
process A has gone to sleep asking kernel to wake it only if resource
which it needs is available. So this process is sleeping.

I think it is not possible for a process to interrupt another process.
Lets understand it by these examples.

Two processes can communicate, bit not interrupt. Communication is
different from interrupts. If process A says "Are u there?" to process
B, process B may say "Yes" or process B may not reply. It is process
A's responcibility to handle all cases like got reply from B, did not
get reply from B, wait indefinetly or return saying error.

For interrupts lets understand it this way. Process A says I want to
write this value to a file. Kernel may decide to write this to the
actual file in the disk. This means disk device driver (this will be
some routine in kernal code) will called by kernal to write the value
to the file. For this time, process A may be put to sleep by kernel
(but not necessarily. If process A is the only process running and it
has more thread then some other thread of A may execute now). If put
to sleep, Kernel will run another process B which may be, say a music
audio for example. When the disk device driver routine will have
completed the writing to file, it will give its retrun valur (remember
its a routine / function for kernal) to kernal. The kernal will then
"interrupt" the sleeping process A as "your job is done". But this it
can not do at any time. It has to find a proper instance during the
running of process B which the kernel can do so. Because to do so, the
kernal has do do a context switch.

There are more issues to this. For example if kernel is executing some
system call, called by B, it may not immediately do the context
switch. In system calls the kernal may be manipulating some of its
internal data structures like in call to malloc etc. So it will do the
context switch only acter this data structure manipulation is over.

On Jun 11, 3:28 pm, sharad kumar  wrote:
> @souravsain
> means that process has slept and asked kernel to wake it only if its
> resource which it need,it got so at that time can any process interrupt it
> or not

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: sleep

2010-06-11 Thread sharad kumar
@souravsain
means that process has slept and asked kernel to wake it only if its
resource which it need,it got so at that time can any process interrupt it
or not

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: sleep

2010-06-10 Thread souravsain
This needs a bit clarification. Interrupts and priority are different.
Priority of a process determines who often it gets CPU slot for
execution. Interrupt is an external (hardware or software) event
raised which may results in temporary context switch from the running
process to handle the interrupt.

So it "uninterruptible priority" is not clear. Please elaborate a bit
more.

On Jun 10, 8:50 pm, sharad  wrote:
> Can process which is sleeping at uninterruptible priority be
> interrupted by higher priority process

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.