[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: Schedule in task_queues works ?

>   I have one interesting doubt
> >   Please have a look at small piece of code 
> > 
> > void   print()
> >   {
> >    printk("The current process %s\n",current->comm);
> >    schedule();
> >    printk(" The current process %s\n",current->comm);
> >   }
> > 
> I'm not sure that you're allowed to use the task queue that way.
> The purpose of the task queue is what they call "software interrupt
> handling". When you get a hardware interrupt, you don't want to spend
> time blocking other irqs, so you queue the work and unmask interrupts.
> At other points in time (return from syscall, interrupt, ctx 
> switch etc), the
> task queue is checked and executed. I think calling schedule, 
> when you're
> in the task queue, will somehow mark the process ineligible 
> for scheduling.

Calling schedule will just call the scheduler and maybe some other process
which is the first in the run queue will get the timeslice.
You call schedule only when you know that you do not want to use the
remaining portion of your time slice. Something similar to pthread_yield()
in the user mode :)