Re: Schedule() call in driver context.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stephan,

I'm no expert this is what I think:

> 1. What event awakes the process? Has the driver any way to control it?

The kernel code executing on behalf of the process is usually waiting
for some resource to become available, we sleep because we can't
return from the middle and have to wait till we get the resource. For
example, consider a write operation being done on a page belonging to
a file -by 2 processes. They both can't write to the same page at the
same time, so what happens is the kernel locks the first page on
behalf of say process 1 and copies data into it, updates its flags and
whatever. Now while this is going on, when the other process tries to
lock the same page, it will be put to sleep (and added to a wait
queue) till the lock is available. You usually don't want to return
till you have this resource available. So during this kind of lock,
the process is put on a wait queue and when the lock is free, any
processes on this queue are woken up. There is usually some sort of a
wait queue for each event/resource and on completion of a certain
event, processes from these lists are woken up.

> 2. Would a timer (kernel timer) do the same? I mean instead calling "schedule()" just
> setup and start a timer which will trigger the same driver function until the device
> service is completed.

You usually don't want to return once you need the resource, so I
don't think a timer would work, but maybe someone else can give a
better explanation about this.

Hope this helps,
-Joel

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux