HP-UX Technical Documentation
Showing results for 
Search instead for 
Do you mean 

Thread - what is the definition of it?

SOLVED
Go to Solution
Frequent Advisor

Thread - what is the definition of it?

I have an intuitive understanding of what a thread is, but I am looking for a formal definition of "thread" as HP-UX understands the term. I have found a lot of references in the HP docs related to how threads are used, but cannot find the definition of the word "thread" itself.

Mott Given
1 ACCEPTED SOLUTION
Acclaimed Contributor Acclaimed Contributor

Re: Thread - what is the definition of it?

Here is one definition supplied by HP (and it's a pretty good English description):

http://devrsrc1.external.hp.com/STKT/partner/threads.html

Here is an excerpt:


A thread (as defined by Maurice Bach's "The Design of the UNIX Operating System") is an independent flow of control within a process, composed of a context (including register set and a program counter) and a sequence of instructions to execute. The traditional flow of control within a program has been a process with a single context of registers, following a single path through the code. This is referred to as the "process-based" or "single-threaded model". For an application in a single-threaded model to handle multiple tasks, it would have to break those tasks up into multiple processes, coordinate with signal handlers to provide some concurrency, or simply deal with those tasks serially (one after the other).

A multi-threaded model for a process allows multiple concurrent paths of execution, or "threads", through the same process, allowing a single process to handle multiple tasks without having to program to serially move from one to the other. A multi-threaded process shares most of the process-related data, with only an additional kthread structure allocated for each of the multiple threads to give its register context, along with a private stack area and related resources. Access to multi-threading functionality is a tool a programmer can choose to use to improve the coding style or throughput of an application.

If it ain't broke, I can fix that.
4 REPLIES
Acclaimed Contributor Acclaimed Contributor

Re: Thread - what is the definition of it?

Here is one definition supplied by HP (and it's a pretty good English description):

http://devrsrc1.external.hp.com/STKT/partner/threads.html

Here is an excerpt:


A thread (as defined by Maurice Bach's "The Design of the UNIX Operating System") is an independent flow of control within a process, composed of a context (including register set and a program counter) and a sequence of instructions to execute. The traditional flow of control within a program has been a process with a single context of registers, following a single path through the code. This is referred to as the "process-based" or "single-threaded model". For an application in a single-threaded model to handle multiple tasks, it would have to break those tasks up into multiple processes, coordinate with signal handlers to provide some concurrency, or simply deal with those tasks serially (one after the other).

A multi-threaded model for a process allows multiple concurrent paths of execution, or "threads", through the same process, allowing a single process to handle multiple tasks without having to program to serially move from one to the other. A multi-threaded process shares most of the process-related data, with only an additional kthread structure allocated for each of the multiple threads to give its register context, along with a private stack area and related resources. Access to multi-threading functionality is a tool a programmer can choose to use to improve the coding style or throughput of an application.

If it ain't broke, I can fix that.
Honored Contributor Honored Contributor

Re: Thread - what is the definition of it?

Still looking for the official definition.

Here is a link to a Prentice Hall book published by the Architects of the kernel thread stuff for HP:

http://www.prenhall.com/allbooks/ptr_0131900676.html

"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Valued Contributor Valued Contributor

Re: Thread - what is the definition of it?

There are 2 types of threads

user threads and
kernel threads

To implement and create kernel threads, you must have access to the appropriate privilegdes. (/etc/privgroup) - man privgrp -

For User threads, you do not. There are some major differences between HP UX 11 and 10.20 when it comes to this issue, so use the references above (posted here above) and that will answer your question in more detail
Man The Bilge Pumps!
Highlighted
Honored Contributor Honored Contributor

Re: Thread - what is the definition of it?

Hello Mott,

Refer to this document for more information.

http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/5965-4642/5965-4642_top.html&co...

HTH.

Happy New Year.

Regards,
Hemanth