home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.wizards
- Path: sparky!uunet!utcsri!torn!cunews!hobbit.gandalf.ca!mbeizer
- From: mbeizer@gandalf.ca (Martin Beizer)
- Subject: Lightweight Processes
- Message-ID: <1992Aug14.194356.8728@gandalf.ca>
- Keywords: lightweight processes, I/O
- Organization: Gandalf Data Ltd.
- Distribution: na
- Date: Fri, 14 Aug 1992 19:43:56 GMT
- Lines: 52
-
- I would appreciate some help with a problem I'm having with lightweight
- processes on a Sparc. (The description below neglects detail for the sake
- of brevity.)
-
- For simulation purposes I am porting a realtime kernel from 68K assembler
- to C on the Sun, using lightweight process calls to save state during
- context switches.
-
- All "user" kernel tasks run at a single LWP priority level
- (although with different priorities in the context of the ported
- kernel). This permits the translated algorithms to control which task
- runs, rather than leaving it up to the lightweight process scheduler.
-
- Context switching in the scheduler looks like:
-
- if (next_task != current_task)
- {
- lwp_resume(next_task->lwp_tid);
- lwp_suspend(last_task->lwp_tid);
- }
-
- In order to simulate a timer interrupt, a higher lwp priority task
- does essentially the following:
-
- while(1)
- {
- lwp_sleep(...)
- if interrupts_ok
- make_timer_task_ready_to_run
- }
-
- This runs the scheduler, and when the interrupt process goes
- back to sleep, causes a preemptive context switch to take place between
- lower LWP level user tasks. (Note that the interrupt process is never
- suspended.)
-
- What happens is:
-
- 1. If output is redirected into a disk file, it works fine.
-
- 2. If output defaults to the terminal, it runs for awhile, until the
- higher priority interrupt process eventually is the only lightweight
- process left running.
-
- It appears that I/O from the user proceses is distrubed by the
- preemptive scheduling ONLY WHEN I/O GOES TO THE TERMINAL.
-
- I've experimented quite a bit. Any ideas?
-
- ----------------------------------------------------------------------
- Martin Beizer Gandalf Systems, Cherry Hill, NJ
- (609) 424-8700 X 5820 mbeizer@gandalf.ca, beizer@infotron.com
-