thread in operating system code example

Example 1: threads in os

A thread is a flow of execution through the process code, 
with its own program counter that keeps track of which instruction to execute next, 
system registers which hold its current working variables,
and a stack which contains the execution history. 
A thread is also called a lightweight process.

Example 2: what is a thread in os

Process is a program in execution.
A thread is a segment of the process.

It is a basic unit of CPU utilization, consisting of a program counter,
a stack, and a set of registers, an ID.

A thread is also called a light-weight process.

Tags:

Java Example