At Tue, 24 Jan 2017 18:52:43 -0500, David Storrs wrote:
> 1) How do I determine what a safe maximum number of threads is?

For a typical program, 10k or so is probably safe.

The program below creates 10k threads. On my machine, it allocates
about 200M of memory with a peak memory use of 160MB.

----------------------------------------

#lang racket/base

(define s (make-semaphore))

(define ts
  (for/list ([i (in-range 10000)])
    (thread
     (lambda ()
       (semaphore-wait s)
       (semaphore-post s)))))

'waiting
(semaphore-post s)

(for ([t (in-list ts)])
  (thread-wait t))

'done

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to