https://github.com/rouming/co_sched
preemptive multitasking in userspace based on a SIGALRM signal
https://github.com/rouming/co_sched
Last synced: 8 months ago
JSON representation
preemptive multitasking in userspace based on a SIGALRM signal
- Host: GitHub
- URL: https://github.com/rouming/co_sched
- Owner: rouming
- Created: 2016-06-15T11:39:40.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-20T15:05:24.000Z (almost 10 years ago)
- Last Synced: 2025-01-04T14:14:39.102Z (over 1 year ago)
- Language: C
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
co_sched - preemptive multitasking in userspace based on a SIGALRM signal
Description:
This is a small experiment, an application, which starts 3 sorting
routines, execution of each is preempted by SIGALRM signal, simulating
an OS timer interrupt. Each routine is an execution context, which
can do a voluntary scheduling (calling schedule() directly) or be
preempted by a timer, and in that case nonvoluntary scheduling occurs.
The default time slice is 10ms, that means that each 10ms SIGALRM fires
and next context is scheduled by round robin algorithm.
Usage:
[roman@pb co_sched]$ make
gcc -O2 -Wall -o co_sched co_sched.c co_sched.S
[roman@pb co_sched]$ ./co_sched
~~~~ let's rock!
[1] test_sort: begin init, a=0x7ffff5210010
[1] test_sort: start sort
[2] test_sort: begin init, a=0x7ffff05c4010
[2] test_sort: start sort
[3] test_sort: begin init, a=0x7fffeb978010
[3] test_sort: start sort
[2] test_sort: end
[3] test_sort: end
[1] test_sort: end
~~~~ i am done