Protothreads
Encyclopedia
In computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

, a protothread is a low-overhead mechanism for concurrent programming.

Protothreads function as stackless
Call stack
In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, control stack, run-time stack, or machine stack, and is often shortened to just "the stack"...

, lightweight threads
Thread (computer science)
In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...

 providing a blocking context cheaply using minimal memory per protothread (on the order of single bytes).

Protothreads are non-preemptable
Preemption (computing)
In computing, preemption is the act of temporarily interrupting a task being carried out by a computer system, without requiring its cooperation, and with the intention of resuming the task at a later time. Such a change is known as a context switch...

. Therefore, a context switch
Context switch
A context switch is the computing process of storing and restoring the state of a CPU so that execution can be resumed from the same point at a later time. This enables multiple processes to share a single CPU. The context switch is an essential feature of a multitasking operating system...

 can only take place on blocking operations
Blocking (computing)
Blocking occurs when a subroutine does not return until it either completes its task or fails with an error or exception. A process that is blocked is one that waits for some event, such as a resource becoming available or the completion of an I/O operation.In a multitasking computer system,...

. Protothreads are also stackless, which means global variable
Global variable
In computer programming, a global variable is a variable that is accessible in every scope . Interaction mechanisms with global variables are called global environment mechanisms...

s are needed for preserving variables across context switches.

The protothread concept was developed by Adam Dunkels
Adam Dunkels
Adam Dunkels, Ph.D., is a Swedish software engineer, researcher and co-founder of the Networked Embedded Systems Group at the Swedish Institute of Computer Science in Kista, Sweden. His research is mainly focused on networking technology and distributed communication for small embedded devices and...

 and Oliver Schmidt.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK