From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v753) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <816BAA19-2DA1-44EB-93D2-E9F5044EA1C2@mac.com> Content-Transfer-Encoding: 7bit From: Pietro Gagliardi Subject: Re: [9fans] Google search of the day Date: Thu, 14 Feb 2008 17:09:04 -0500 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Topicbox-Message-UUID: 546e2dc0-ead3-11e9-9d60-3106f5b1d025 Here's what I think is the best solution: statically allocate the maximum number of tasks per process: struct JobControlBlock { /* the name my OS uses for the info field of a process (job) */ Task *mainTask; /* task == thread */ Task *jobTasks[400]; /* pointers to entry in an array of statically allocated tasks */ }; A Task runs a function; it does not continue executing at the current point. Returning from that function halts the task. Returning from the main task halts all tasks. Now a SpawnTask() (fork()) can only be done to create up to 400 tasks with the exception of the main task.