Actually, you may simulate execution of several threads at the same time. Even with 'real' Posix threads, if you have 1 CPU, in the hardware threads are executed sequentially. The difference between preemptive threads and Pth (in 1 CPU case) is only discipline of threads switching. Preemptive threads may be switched without user intervention by kernel via some hardware interrupt (timer, for example). Pth may be switched only by user request. Pth may switch during several function calls (like read, select etc) or by yield() function (or pth_yield(), I have no manual handy). If your threads do not call one of 'switcheable' functions, yield() is the only solution.

So, call yield() with some reasonable frequency in your threads.

Vladimir

Srinath, Srivatsa wrote:
[EMAIL PROTECTED]">
If it executes sequentially, then I can just make function calls instead of
creating threads isnt it? Or, is there a way that I can make it work
differently?

Sri.

-----Original Message-----
From: David Schwartz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 21, 2001 5:53 PM
To: [EMAIL PROTECTED]
Subject: RE: POSIX flavor on NetBSD



I have installed the Pth library for POSIX, that is, with POSIX 
API wrapper.
I am running a NetBSD 1.5 on ARM32. Single CPU. I created 3 thread using
pthread_create and I wait for them to execute with pthread_join.
The threads
seem to execute sequentially than simultaneously. Please advise!!

That's how PTH works.

DS

______________________________________________________________________
GNU Portable Threads (Pth) http://www.gnu.org/software/pth/
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager (Majordomo) [EMAIL PROTECTED]

______________________________________________________________________
GNU Portable Threads (Pth) http://www.gnu.org/software/pth/
User Support Mailing List [EMAIL PROTECTED]
Automated List Manag! er! (Majordomo) [EMAIL PROTECTED]




Reply via email to