#!perl -slw use strict; use threads; use POSIX qw( WNOHANG ); use Time::HiRes qw(gettimeofday); use Inline C => <<'END_OF_CODE'; #include void yield_me() { sched_yield(); } END_OF_CODE my (@time,$a); sub thread{ while (1) { # gettimeofday(); yield_me() } } my @forks = map{ if (my $pid=fork){waitpid(-1,WNOHANG)}elsif($pid==0){thread()}else{die "Cannot fork"} } 1 .. 10; ;