[Fwd: Re: Question about scheduler 2.4]

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

 



I respond to myself.

I have found the answer in my other book about the linux kernel, Linux Kernel Development, by Robert Love, exactly in the time management chapter.

I was right about my consideration.
The timer interrupt decrements the current process counter.
If the process interrupted by interrupt timer is just become ready, the timer interrupt decrement the counter of the current process, and it is not a correct operation because the timer interval has been used by other processes.


The scheduler uses this method because it must not lose too much time to choose the process to run.
The scheduler of Linux has been studied to sharing the CPU among processes, not to choose perfectly the process to run.
So this method theorically is not fair, but it works fine.


This is my explanation.

Regards
Paolo Minazzi



Paolo Minazzi wrote:

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