scheduler implementation.

scheduler implementation.

Post by Raymond La » Sat, 19 Sep 1998 04:00:00



Assuming a process is scheduled to run within a quantum of time.  When
the quantum of time is expired, how does the scheduler stop the process
that is currently running?
What would be an "efficient way" to force a process to stop, make sure
it is stopped,
and start another process?

I like to know how the scheduler is implemented on a UNIX system (RISC
perferred).

Also, does anyone know how one might implement sched_yield()?
What is the scheduler's role when a process calls sched_yield()??

The Linux Kernel book does not go into detail on sched_yield() or any
yield function.

Thanks

--

 
 
 

scheduler implementation.

Post by Barry Margoli » Sat, 19 Sep 1998 04:00:00



Quote:>Assuming a process is scheduled to run within a quantum of time.  When
>the quantum of time is expired, how does the scheduler stop the process
>that is currently running?
>What would be an "efficient way" to force a process to stop, make sure
>it is stopped,
>and start another process?

>I like to know how the scheduler is implemented on a UNIX system (RISC
>perferred).

It's basically the same way as timesharing OSes have been implemented for
decades.  There's a real-time clock interrupt that occurs periodically.
Interrupts automatically cause the system to run an interrupt handler in
system mode.  This interrupt handler does things like update the
time-of-day clock and checks whether the current process's quantum has run
out.  If so, it switches to the next process in the run queue.

There's no need to "make sure it has stopped" -- this is the OS, the master
controller of the system.  Processes aren't autonomous -- if the scheduler
doesn't run them, they don't run.

Quote:>Also, does anyone know how one might implement sched_yield()?
>What is the scheduler's role when a process calls sched_yield()??

sched_yield() would just do the same actions that are done normally when a
quantum runs out.

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.

 
 
 

1. Scheduler queue implementation ...

They are often close to the same thing. Take a look at the constraints
on virtually cached processors like the ARM where they _are_ the same thing.

Equal mm for cpu sucking tasks often means equal cache image. On the other
hand unmatched mm pretty much definitively says "doesnt matter". The cost
of getting the equal mm/shared cache case wrong is too horrific to handwave
it out of existance using academic papers.

You don't seem to solve either problem directly.

Without per cpu queues you spend all your time bouncing stuff between
processors which hurts. Without multiple queues for interactive tasks you
walk the interactive task list so you don't scale. Without some sensible
handling of mm/cpu binding you spend all day wasting ram bandwidth with
cache writeback.

The single cpu sucker queue is easy, the cost of merging mm equivalent tasks
in that queue is almost nil. Priority ordering interactive stuff using
several queues is easy and very cheap if you need it (I think you do hence
I have 7 priority bands and you have 1). In all these cases the hard bits
end up being

On a wake up which cpu do you give a task ?
When does an idle cpu steal a task, who from and which task ?
How do I define "imbalance" for cpu load balancing ?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. missing extensions when running XFree86 4.0.1

3. CFQ disk scheduler (was Re: [PATCH] SFQ disk scheduler)

4. : BuyUNIXPC.com Launches Website For The Unix Enthusiast!

5. O(1) Scheduler from Ingo vs. O(1) Scheduler from Robert

6. LOCAL: Hans Resier speaking in Davis - TODAY (July 15th)

7. Looking for an appointments scheduler rolodex kindof program for X

8. Easy Changing of NIS Passwords by ROOT

9. Scheduler Cleanup

10. pthreads and the scheduler policies

11. backwards scheduler?

12. scheduler interactivity - does this patch help?

13. PACKET SCHEDULER WANTED!!!