Question about scheduler 2.4

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

 



Hi.
It the first time I write in this forum, but I read the messages very often.
I have read the books "Understanding The Linux Kernel 2nd Edition". Wonderful book.


I cannot understand a simple thing about the scheduler of kernel 2.4.x.

I know that the timer interrupt stops the CPU every 10ms (0.010) and executes the following operation:

current->counter--;

to decrement the counter of the current process.

I don't understand one point.
I will try to describe my problem with a simple example.

Suppose we have 2 processes, A and B.
At the time 0 the process A starts, it uses the CPU until the instant of time 0.009 (9ms).
At this instant of time the process A tries to read a key from the keyboard, but there are not key in the keyboard buffer,so the process A is stopped waiting for the pression of a key.
So the scheduler at the instand 9ms begin to run the process B. After few time (1ms) happens a timer interrupt, and the processB->counter is decremented.


BUT THIS IS NOT FAIR ! The CPU has been used from the process A, but the counter of the process B has been decremented !
This is the point I cannot understand.


Thanks in advance.

Paolo Minazzi

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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