From 0895365659e3318b8d2ce6c29a362b5378564f8d Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 27 Jul 1994 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1994-07-27 --- port/portdat.h | 2 ++ port/proc.c | 14 +++++++++----- port/sysproc.c | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/port/portdat.h b/port/portdat.h index afec73e1f3cf6e34bac5a6c6b7611fff44947786..f6bdaa6e3f573e0c448ae8942a05a1794cfbe4f6 100644 --- a/port/portdat.h +++ b/port/portdat.h @@ -579,6 +579,7 @@ struct Proc Mach *mp; /* machine this process last ran on */ ulong affinity; /* affinity counter for that mach */ ulong movetime; /* ticks when proc was last reassigned */ + ulong priority; void *ureg; /* User registers for notes */ void *dbgreg; /* User registers for devproc */ @@ -689,3 +690,4 @@ extern int mouseshifted; extern int mousetype; extern int mouseswap; extern int nsyscall; +extern Physseg physseg[]; diff --git a/port/proc.c b/port/proc.c index 703a8865ca221609b07c213f6403678052a0c87f..4fd3ecf952663f4502f9da7fa817ca15563d8a7b 100644 --- a/port/proc.c +++ b/port/proc.c @@ -22,7 +22,7 @@ struct }waitqalloc; int nrdy; -Schedq runhiq; +Schedq runhiq; /* for hi priority process, don't bother with affinity */ char *statename[] = { /* BUG: generate automatically */ @@ -113,7 +113,9 @@ ready(Proc *p) s = splhi(); - if(p->state == Running) + if(p->priority) + rq = &runhiq; + else if(p->state == Running) rq = &balance(p)->loq; else rq = &affinity(p)->hiq; @@ -140,16 +142,18 @@ runproc(void) loop: spllo(); - while(m->hiq.head == 0 && m->loq.head == 0) + while(runhiq.head == 0 && m->hiq.head == 0 && m->loq.head == 0) ; splhi(); - if(m->hiq.head) + lock(&runhiq); + if(runhiq.head) + rq = &runhiq; + else if(m->hiq.head) rq = &m->hiq; else rq = &m->loq; - lock(&runhiq); p = rq->head; /* p->mach==0 only when process state is saved */ if(p == 0 || p->mach){ diff --git a/port/sysproc.c b/port/sysproc.c index a9a55bcba9b715d5432ed5bd8bee6b84afdd4180..f877e7bc4c419ad95ea5aea26b07664f5dc12338 100644 --- a/port/sysproc.c +++ b/port/sysproc.c @@ -380,6 +380,11 @@ sysexec(ulong *arg) s->top = USTKTOP; relocateseg(s, USTKTOP-TSTKTOP); + /* + * '/' processes are high priority (hack to make /ip more responsive) + */ + if(devchar[tc->type] == L'/') + up->priority = 1; close(tc); /*