Commit Graph

68 Commits

Author SHA1 Message Date
Jyun-Yan You
b778dac197 fix build on freebsd 2012-02-09 18:41:57 -08:00
Brian Anderson
2f4e7c157e rt: Export a scheduler API 2012-02-08 15:42:51 -08:00
Brian Anderson
f2a1aa2649 rt: Hold schedulers in a map 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
ebc3646c39 rt: Start schedulers immediately upon creation 2012-02-08 15:42:51 -08:00
Brian Anderson
7685e5de94 rt: Refactor the rust_kernel interface a bit 2012-02-08 15:42:47 -08:00
Brian Anderson
ad80823a6c rt: Introduce scheduler ids 2012-02-08 15:33:40 -08:00
Brian Anderson
c76b81cddf rt: Delete schedulers immediately upon release
This will be needed once we support dynamically changing schedulers.
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
e818406072 rt: Expand rust_kernel::live_tasks to a uintptr_t 2012-02-04 01:15:00 -08:00
Brian Anderson
9fa950ec53 rt: Stop using atomic ops on rust_kernel::live_tasks
These ops are all done within spitting distance of a suitable lock,
so just protect it with the lock.
2012-02-04 00:31:43 -08:00
Brian Anderson
c7777f4fd9 rt: Add sanity checks when we hit the max task/port id 2012-02-03 23:48:12 -08:00
Brian Anderson
12fa90888e rt: Clean up the way the kernel tracks tasks 2012-02-03 23:48:12 -08:00
Brian Anderson
e7f00b6493 rt: Do all task creation through a scheduler 2012-02-03 23:48:12 -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
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
5c3c8d454d rt: Do all signalling while holding a lock
This will matter once the scheduler is changed to not wake up on a timer
2012-02-02 18:10:24 -08:00
Brian Anderson
f954ce5ef1 rt: Remove calls to signal the kernel lock
Nobody ever waits for it
2012-02-01 16:05:17 -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
Brian Anderson
0616cba62b libcore: Add sys::set_exit_status
Sets the process exit code
2012-01-12 22:24:27 -08:00
Niko Matsakis
8506241f3a fix how we walk functions to match new closure fmt 2012-01-06 22:40:31 -08:00
Brian Anderson
854daaec0c rt: Lock before using the random number generator
Seeing crashes here trying to stress test concurrent tasks
2011-12-20 20:56:06 -08:00
Patrick Walton
5209b19255 rt: Rename rand() to isaac_rand() since the former prevents lots of standard headers from being included 2011-09-20 15:34:47 -07:00
Brian Anderson
0ea55ffdc8 Use a unique exit status when the runtime fails normally
Check for it in run-fail tests
2011-09-11 17:31:40 -07:00
Brian Anderson
a0208e3899 Return an error code after fail under win32 2011-08-24 12:03:07 -07:00
Eric Holk
ae89ea223d Making more of the rust_task structure directly accessible from Rust. 2011-08-17 14:42:40 -07:00
Brian Anderson
977d8ba0e9 Abort abruptly on failure on windows
Trying to shutdown cleanly results in wierd failures
2011-08-15 19:25:47 -07:00
Eric Holk
5c6790519b Reducing the chances for race conditions in join. 2011-08-15 12:39:55 -07:00
Eric Holk
d63f8340a5 Properly ref counting to fix valgrind issues on linux. 2011-08-15 09:26:52 -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
Brian Anderson
d552a0b959 Minimize scheduler locking on task creation
This takes my CPU utilization on task-perf-spawnalot from 35% to 55%
2011-07-29 23:02:51 -07:00
Brian Anderson
6657e729de Lock the new task's scheduler when creating a task
Previously we were locking the spawning task's scheduler. I couldn't
see that that was protecting anything. The newborn_task list in the new task's
scheduler though was unprotected from concurrent access. So now we're locking
the new task's scheduler.
2011-07-29 22:43:11 -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
b85dee8d5b Resurrecting some of the logging in rust_chan.cpp 2011-07-28 10:47:28 -07:00
Eric Holk
9ea8476faa Removed outdated comment. 2011-07-28 10:47:28 -07:00
Eric Holk
5302cde188 Made task threads wait instead of sleep, so they can be woken up. This appears to give us much better parallel performance.
Also, commented out one more unsafe log and updated rust_kernel.cpp to compile under g++
2011-07-28 10:47:28 -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
Eric Holk
3ae4dcd41e Lots of work on memory tracking and channels.
We're trying to get closer to doing correct move semantics for channel
operations. This involves a lot of cleanup (such as removing the
unused sched parameter from rust_vec constructor) and making
circular_buffer kernel_owned.

Added tagging for memory allocations. This means we give a string tag
to everything we allocate. If we leak something and TRACK_ALLOCATIONS
is enabled, then it's much easier now to tell exactly what is leaking.
2011-07-21 11:51:22 -07:00
Graydon Hoare
39151f2ad8 Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases. 2011-07-13 15:44:09 -07:00
Graydon Hoare
49116adbe9 Fix compile-command lines in rt. 2011-07-13 13:51:20 -07:00
Rob Arnold
2e2e1f7cb3 Add realloc method to rust_kernel 2011-07-06 20:37:27 -07:00
Patrick Walton
91eb63eaee rt: Add a stack check to upcall_get_type_desc 2011-07-06 15:07:04 -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
Eric Holk
02f6645fca Moved win32_require to the kernel. 2011-06-28 16:12:33 -07:00