lkml.org 
[lkml]   [1998]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Question about linux drivers


On Tue, 17 Nov 1998, Paul Barton-Davis wrote:

> Alessandro Rubini <rubini@pop.systemy.it> writes:
>
> >> [...] Is there any ways to automate this? I.e. I call a function
> >> before I enter this loop that sais: "It's OK to switch
> >> process/context when appropriate", so I don't have to worry about
> >> locking the whole kernel.
> >
> >Yes. You can change current->state to TASK_INTERRUPTIBLE, and then
> >call schedule(). If a process is wating for processor time, it will
> >get it. Change back current->stat to TASK_RUNNING when you are done.
> >
> >The kernel is full of such examples.
>
> I think that your example requires:
>
> while (!done_computing) {
> if (loops++ % some_constant == 0) {
> current->state = TASK_INTERRUPTIBLE;
> schedule();
> current->state = TASK_RUNNING; /* redundant, i think */
> } else {
> compute ();
> }
>
> whereas I think the questioner wanted:
>
> tell_scheduler_that_i_do_not_really_matter ();
> while (!done_computing) {
> compute();
> }
>

i'd say that the second piece of code is just a userspace program.
Right ?

Vladimir Dergachev


> I can't think of anyway of doing the second way. I don't know what the
> semantics are of marking current->state as TASK_INTERRUPTIBLE but *NOT*
> calling schedule().
>
> Perhaps I misunderstood your suggestion Alessandro.
>
> --p
>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/
>


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.103 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site