LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-14-2006, 07:21 PM   #1
cathiejcm
LQ Newbie
 
Registered: Nov 2005
Posts: 5

Rep: Reputation: 0
Question linux cpu scheduling on RT processes


helooo..can anybody explain the cpu scheduling of linux?

from what i've researched, the processes are on priority arrays. and that RR scheduled RT(real time) processes are always preempted by FIFO scheduled RT processes.

but what if a higher priority RR sched RT process than a FIFO sched RT process in the runqueue arrives? is the FIFO sched RT process preempted? which one gets the CPU?

i'm kinda confused which first to consider. the priority or the sched policy of a process?

i'd really appreciate some help on this..waaahhhhh
 
Old 01-15-2006, 03:08 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
i most certainly will get some of this wrong but i will try to answer.
I agree with you it is confusing especially how priority fits in to the RT picture if at all.and of course it's changing all the time now there is
(policy) == SCHED_NORMAL
(policy) == SCHED_FIFO
(policy) == SCHED_RR
(policy) == SCHED_ISO_RR
(policy) == SCHED_ISO_FIFO
realtime FIFO threads are the highest priority and are not preemptable and don't give up the CPU to anything except a new realtime FIFO thread or if the FIFO thread blocks. FIFOs don't get timeslices and are not subject to the clock. They just run until they are done. So that aspect of priority in the schedular namely larger timeslice for higher priority is out the window.
I think the nice value for rt tasks is calculated but has no effect unless the thread becomes SCHED_NORMAL.Only one valid priority for SCHED_FIFO and SCHED_RR and are set by setscheduler() i think.
Code:
	switch (policy) {
	case SCHED_FIFO:
	case SCHED_RR:
		ret = 1;
		break;
	case SCHED_NORMAL:
		ret = 0;
	}
RR threads are like FIFO threads but they use timeslices.
Code:
if (unlikely(rt_task(p))) {
		/*
		 * RR tasks need a special form of timeslice management.
		 * FIFO tasks have no timeslices.
		 */
		if ((p->policy == SCHED_RR) && !--p->time_slice) {
			p->time_slice = task_timeslice(p);
			p->first_time_slice = 0;
			set_tsk_need_resched(p);

			/* put it at the end of the queue: */
			dequeue_task(p, rq->active);
			enqueue_task(p, rq->active);
		}
If multiple realtime RR threads are running, each one is run for its timeslice, after which it goes to the end of the list of realtime RR threads.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
commands for Scheduling processes jadukor Slackware 4 12-16-2005 06:19 PM
editing the linux cpu scheduling algo cathiejcm Linux - Software 1 11-11-2005 07:25 AM
Process scheduling (CPU) kiwi_bloke *BSD 1 08-29-2004 09:07 PM
Seeing what processes are running and how much CPU they are using? DiZASTiX Linux - General 2 06-07-2003 03:05 PM
Processor affinity and cpu scheduling...? Thaidog Linux - Newbie 5 01-09-2003 07:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration