I'm working on the POSIX subsystem of my operating system project, and I've reached the point where I would like to work on pthreads support. However, I'm not certain about the extent to which I should implement them.
What is the most-used pthreads functionality? Is there anything I could safely "just stub out" for now and implement it when we port an application that requires it? My research so far points to the basic thread operations (create, join, etc...) - that's quite obvious - and mutex support. Realistically speaking, do applications use much more than this?
I guess I'm just trying to figure out how little I can get away with while still having a working implementation.
I'd suggest a bare bones pthread implementation cover the following functions (with "pthread_
" prefixes removed):
create
, exit
, join
, detach
, self
, equal
, and "attr
" support of joinability/detachabilityatfork
, kill
and sigmask
cond
and mutex
functions (default attributes only -- nothing fancy!), possibly omitting cond_timedwait
Take a look at the SUSv6 entry on <pthread.h>
, which I link in preference to SUSv7 because version 6 has more option groups called out in this header. I composed the above list by striking any optional features, and then dropping other sets of functionality that my personal history and observation suggest are inessential (e.g., thread-specific data) or both inessential and dangerous (e.g., thread cancellation). :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With