summaryrefslogtreecommitdiff
path: root/rts/posix/Select.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug introduced in fac8ecbbafde17dd92439c41747223c43e9d2b80Simon Marlow2012-01-191-6/+6
| | | | Fixes recent failures in hGetBuf001.
* Fix bug causing polling instead of blocking in the non-threaded RTS (#5773)Simon Marlow2012-01-161-18/+17
| | | | | | | | | This was a regression introduced accidentally in 6b1098511aaabd2c9503ee7be6da1944466f9cb4. We were previously passing a large time value to select() to simulate blocking, and this broke due to a change from unsigned to signed arithmetic. I've refactored it to be less fragile now - we just pass NULL as the timeval parameter to select(), which is the correct way to do blocking.
* Time handling overhaulSimon Marlow2011-11-251-14/+25
| | | | | | | | | | | | | | | | | | | | | Terminology cleanup: the type "Ticks" has been renamed "Time", which is an StgWord64 in units of TIME_RESOLUTION (currently nanoseconds). The terminology "tick" is now used consistently to mean the interval between timer signals. The ticker now always ticks in realtime (actually CLOCK_MONOTONIC if we have it). Before it used CPU time in the non-threaded RTS and realtime in the threaded RTS, but I've discovered that the CPU timer has terrible resolution (at least on Linux) and isn't much use for profiling. So now we always use realtime. This should also fix The default tick interval is now 10ms, except when profiling where we drop it to 1ms. This gives more accurate profiles without affecting runtime too much (<1%). Lots of cleanups - the resolution of Time is now in one place only (Rts.h) rather than having calculations that depend on the resolution scattered all over the RTS. I hope I found them all.
* Implement stack chunks and separate TSO/STACK objectsSimon Marlow2010-12-151-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes two changes to the way stacks are managed: 1. The stack is now stored in a separate object from the TSO. This means that it is easier to replace the stack object for a thread when the stack overflows or underflows; we don't have to leave behind the old TSO as an indirection any more. Consequently, we can remove ThreadRelocated and deRefTSO(), which were a pain. This is obviously the right thing, but the last time I tried to do it it made performance worse. This time I seem to have cracked it. 2. Stacks are now represented as a chain of chunks, rather than a single monolithic object. The big advantage here is that individual chunks are marked clean or dirty according to whether they contain pointers to the young generation, and the GC can avoid traversing clean stack chunks during a young-generation collection. This means that programs with deep stacks will see a big saving in GC overhead when using the default GC settings. A secondary advantage is that there is much less copying involved as the stack grows. Programs that quickly grow a deep stack will see big improvements. In some ways the implementation is simpler, as nothing special needs to be done to reclaim stack as the stack shrinks (the GC just recovers the dead stack chunks). On the other hand, we have to manage stack underflow between chunks, so there's a new stack frame (UNDERFLOW_FRAME), and we now have separate TSO and STACK objects. The total amount of code is probably about the same as before. There are new RTS flags: -ki<size> Sets the initial thread stack size (default 1k) Egs: -ki4k -ki2m -kc<size> Sets the stack chunk size (default 32k) -kb<size> Sets the stack chunk buffer size (default 1k) -ki was previously called just -k, and the old name is still accepted for backwards compatibility. These new options are documented.
* give a better error message in the non-threaded RTS for out-of-range FDsSimon Marlow2010-09-291-2/+10
| | | | | | # ./aw aw: file descriptor 1027 out of range for select (0--1024). Recompile with -threaded to work around this.
* Test for (fd < 0) before trying to FD_SET itIan Lynagh2010-08-041-2/+2
|
* #include <sys/select.h> if we have it (#3760)Simon Marlow2009-12-161-0/+4
|
* RTS tidyup sweep, first phaseSimon Marlow2009-08-021-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first phase of this tidyup is focussed on the header files, and in particular making sure we are exposinng publicly exactly what we need to, and no more. - Rts.h now includes everything that the RTS exposes publicly, rather than a random subset of it. - Most of the public header files have moved into subdirectories, and many of them have been renamed. But clients should not need to include any of the other headers directly, just #include the main public headers: Rts.h, HsFFI.h, RtsAPI.h. - All the headers needed for via-C compilation have moved into the stg subdirectory, which is self-contained. Most of the headers for the rest of the RTS APIs have moved into the rts subdirectory. - I left MachDeps.h where it is, because it is so widely used in Haskell code. - I left a deprecated stub for RtsFlags.h in place. The flag structures are now exposed by Rts.h. - Various internal APIs are no longer exposed by public header files. - Various bits of dead code and declarations have been removed - More gcc warnings are turned on, and the RTS code is more warning-clean. - More source files #include "PosixSource.h", and hence only use standard POSIX (1003.1c-1995) interfaces. There is a lot more tidying up still to do, this is just the first pass. I also intend to standardise the names for external RTS APIs (e.g use the rts_ prefix consistently), and declare the internal APIs as hidden for shared libraries.
* cope with ThreadRelocated on the sleeping_queueSimon Marlow2009-02-171-2/+8
|
* Cope with ThreadRelocated when traversing the blocked_queueSimon Marlow2008-11-061-0/+5
| | | | Fixes "invalid what_next field" in ioref001 on Windows, and perhaps others
* Add a write barrier to the TSO link field (#1589)Simon Marlow2008-04-161-7/+7
|
* FIX BUILD FD_SETSIZE signedjochemberndsen@dse.nl2007-09-271-2/+6
| | | | | On FreeBSD FD_SETSIZE is unsigned. Cast it to a signed int for portability.
* wakeUpSleepingThreads: fix off by oneSimon Marlow2007-07-181-1/+1
| | | | | | The symptom of this bug is after the time of a threadDelay has expired, the RTS does a whole slew of extra select() calls. This should help with #1523, but it's not the whole story.
* Add an --install-signal-handlers=<yes|no> RTS flag; fixes trac #804Ian Lynagh2007-03-221-1/+1
|
* Split GC.c, and move storage manager into sm/ directorySimon Marlow2006-10-241-0/+1
| | | | | | | | | | | | | | | | | In preparation for parallel GC, split up the monolithic GC.c file into smaller parts. Also in this patch (and difficult to separate, unfortunatley): - Don't include Stable.h in Rts.h, instead just include it where necessary. - consistently use STATIC_INLINE in source files, and INLINE_HEADER in header files. STATIC_INLINE is now turned off when DEBUG is on, to make debugging easier. - The GC no longer takes the get_roots function as an argument. We weren't making use of this generalisation.
* new RTS flag: -V to modify the resolution of the RTS timerIan Lynagh2006-09-051-1/+1
| | | | | | | | | Fixed version of an old patch by Simon Marlow. His description read: Also, now an arbitrarily short context switch interval may now be specified, as we increase the RTS ticker's resolution to match the requested context switch interval. This also applies to +RTS -i (heap profiling) and +RTS -I (the idle GC timer). +RTS -V is actually only required for increasing the resolution of the profile timer.
* Match format strings and arguments for printf-like functionssven.panne@aedion.de2006-08-101-2/+2
|
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+279
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.