Commit Graph

43 Commits

Author SHA1 Message Date
Brian Anderson
e325146eb4 Merge remote-tracking branch 'brson/mainthread'
Conflicts:
	src/rt/rust_kernel.cpp
	src/rt/rust_scheduler.cpp
	src/rt/rust_scheduler.h
2012-04-03 20:30:01 -07:00
Brian Anderson
c0e12854ed rt: Fix bugs in the osmain scheduler 2012-04-03 18:01:13 -07:00
Jon Morton
632a4c9326 Refactor includes structure, getting rid of rust_internal.h
Many changes to code structure are included:
- removed TIME_SLICE_IN_MS
- removed sychronized_indexed_list
- removed region_owned
- kernel_owned move to kernel.h, task_owned moved to task.h
- global configs moved to rust_globals.h
- changed #pragma once to standard guard in rust_upcall.h
- got rid of memory.h
2012-04-03 16:02:38 -07:00
Brian Anderson
e1858882a4 rt: Run a single-threaded scheduler on the main thread 2012-04-02 15:35:47 -07:00
Jon Morton
128a8b6ed5 remove rust_srv 2012-04-01 22:18:40 -05:00
Brian Anderson
7c1be236a5 rt: Introduce rust_sched_launcher_factory. Sorry, I need one 2012-04-01 17:27:18 -07:00
Brian Anderson
fb528dd7d6 rt: Allow some schedulers to stay alive even without tasks to execute 2012-04-01 16:57:14 -07:00
Brian Anderson
e78396850d Merge remote-tracking branch 'brson/mainthread'
Conflicts:
	src/rt/rust_sched_loop.cpp
	src/rt/rust_shape.cpp
	src/rt/rust_task.cpp
2012-04-01 00:15:04 -07:00
Brian Anderson
21064637ed rt: Fix whitespace 2012-03-31 23:12:06 -07:00
Brian Anderson
6bf8d19712 rt: Extract rust_sched_launcher from rust_task_thread
rust_sched_launcher is actually responsible for setting up the thread and
starting the loop. There will be other implementations that do not actually
set up a new thread, in order to support scheduling tasks on the main OS
thread.
2012-03-31 19:51:29 -07:00
Jon Morton
8aee42a382 Choose task thread in rust_scheduler by round robin
Remove the random context from rust_scheduler and use a simple round robin system to choose which thread a new task gets put on. Also, some incorrect tab indents around scoped blocks were fixed.
2012-03-31 02:14:44 -05:00
Brian Anderson
f5f6135fd0 rt: Stop using large stacks for the main task 2012-03-21 19:10:32 -07:00
Brian Anderson
1366d65660 rt: Remove remaining uses of rust_kernel::get_task_by_id 2012-03-15 11:10:52 -07:00
Brian Anderson
b3f77bf927 rt: Change the way the kernel exits to avoid pthread leaks
This makes the kernel join every scheduler thread before exiting in order to
ensure that all threads are completely terminated before the process exits. On
my machine, for 32-bit targets, this was causing regular valgrind errors.
2012-02-27 14:25:32 -08:00
Brian Anderson
2f4e7c157e rt: Export a scheduler API 2012-02-08 15:42:51 -08:00
Brian Anderson
028af5cb6c rt: Change the lifecycle of tasks and schedulers for various reasons
This is in preparation for giving schedulers their own life cycle separate
from the kernel.

Tasks must be deleted before their scheduler thread, so we can't let the
scheduler exit before all its tasks have been cleaned up. In this scheme,
the scheduler will unregister tasks with the kernel when they are reaped,
then drop their ref on the task (there may still be others). When the task
ref count hits zero, the task will request to be unregistered from the
scheduler, which is responsible for deleting the task.

Instead of having the kernel tell the scheduler to exit, let the scheduler
decide when to exit. For now it will exit when all of its tasks are
unregistered.
2012-02-08 15:42:51 -08:00
Brian Anderson
ad80823a6c rt: Introduce scheduler ids 2012-02-08 15:33:40 -08:00
Brian Anderson
f39e64d56a rt: Change the scheme used for terminating the kernel
Instead of joining on the scheduler threads, instead keep a count of active
schedulers. When there are no more schedulers raise a signal for the main
thread to continue.

This will be required once schedulers can be added and removed from the
running kernel.
2012-02-08 15:33:40 -08:00
Brian Anderson
fad3de5900 rt: Remove rust_scheduler::rval. Unused 2012-02-08 15:33:40 -08:00
Brian Anderson
8d881967a2 rt: Extract rust_scheduler from rust_task_thread 2012-02-03 23:48:12 -08:00
Brian Anderson
f94339cc1c rt: Rename rust_scheduler to rust_task_thread 2012-02-03 23:48:12 -08:00
Brian Anderson
b1a090c7c4 rt: Remove unused arguments in rust_scheduler 2012-02-02 18:17:33 -08:00
Brian Anderson
f719ea552b rt: Remove rust_scheduler::interrupt_flag. Unused 2012-02-02 18:10:24 -08:00
Brian Anderson
aee83d2ff1 rt: Only wake up all schedulers when no tasks are left
At the moment there's not really any reason to be raising this signal,
since they schedulers wake up periodically anyway, but once we remove
the timer this will be how the schedulers know to exit.
2012-02-02 18:10:24 -08:00
Brian Anderson
6548cdd59b rt: Make the initial segment of the main task's stack 1MB
This is a trick to fool microbenchmarks. Closes #1681
2012-01-29 21:20:39 -08:00
Marijn Haverbeke
9a7061dfab Fix some bad code in the dict interner
Issue #1436
2012-01-08 21:57:54 +01:00
Marijn Haverbeke
822acdd170 Make binding of fns with bounded type parameters work
Interns non-static dicts to heap-allocated equivalents so that they no
longer have stack scope.

Closes #1436
2012-01-06 17:40:05 +01:00
Graydon Hoare
5930463faa Tidy up some drift in runtime logging, close #1380. 2011-12-28 11:53:12 -08:00
Patrick Walton
e8757ea01f rt: Expose the C stack inside the Rust scheduler so that C calls can switch to it 2011-09-28 10:22:02 -07:00
Patrick Walton
9ba86178ef rt: Store the task in TLS 2011-09-27 18:12:03 -07:00
Patrick Walton
880fd788eb rustc: Add an extra flag to object tydescs so that shapes know how to find the captured subtydescs 2011-08-25 12:01:10 -07:00
Michael Sullivan
eb368d1b34 Remove rc_base. Closes #603. 2011-08-18 15:49:58 -07:00
Brian Anderson
0cd607bcbd rt: Shutdown gracefully on failure
When the kernel fails, kill all tasks and wait for the schedulers to stop
instead of just exiting. I'm sure there are tons of lurking issues here but
this is enough to fail without leaking (at least in the absence of cleanups).
2011-08-10 13:02:31 -07:00
unknown
44bef5f2cb Introduced task handles.
This is the new way to refer to tasks in rust-land. Currently all they
do is serve as a key to look up the old rust_task structure. Ideally
they won't be ref counted, but baby steps.
2011-08-08 16:55:38 -07:00
Eric Holk
d1dbb99984 Removing proxies and message queues. 2011-07-29 18:54:59 -07:00
Brian Anderson
4ef1ec580a Do all runtime calls to getenv at initialization
getenv is not threadsafe and (maybe as a result) it's randomly crashing with
CFLAGS=-g and RUST_THREADS=32. Calls from rust code are still on their
own.
2011-07-28 12:23:01 -07:00
Eric Holk
3d7016ae95 Updating to work on Windows. 2011-07-28 10:47:29 -07:00
Eric Holk
62bc6b5113 Per-thread scheduling. Closes #682.
Tasks are spawned on a random thread. Currently they stay there, but
we should add task migration and load balancing in the future. This
should drammatically improve our task performance benchmarks.
2011-07-28 10:47:28 -07:00
Eric Holk
b51f5c395c Made root_task no longer special. 2011-07-28 10:47:28 -07:00
Graydon Hoare
49116adbe9 Fix compile-command lines in rt. 2011-07-13 13:51:20 -07:00
Eric Holk
63dcd325b9 Adding support for pinning tasks to the currently running thread. Closes #598. 2011-06-29 18:47:47 -07:00
Graydon Hoare
c796a8f24d Re-enable tidy (it was broken) and fix various non-tidy things. 2011-06-29 15:14:55 -07:00
Eric Holk
657e5a2bd5 Renamed what's left of rust_dom to rust_scheduler 2011-06-28 16:12:33 -07:00