| 1 | \chapter{\uC} \label{uC} | 
|---|
| 2 |  | 
|---|
| 3 | \section{Introduction} | 
|---|
| 4 | \uC \cite{Reference10} extends the \CC programming language with new | 
|---|
| 5 | mechanisms to | 
|---|
| 6 | facilitate control flow, and adds new objects to enable lightweight concurrency | 
|---|
| 7 | on uniprocessor and parallel execution on multiprocessor computers. Concurrency has tasks | 
|---|
| 8 | that can context switch, which is a control transfer from one execution state to | 
|---|
| 9 | another that is different from a function call. Tasks are selected to run on a | 
|---|
| 10 | processor from a ready queue of available tasks, and tasks may need to wait for an occurrence of an event. | 
|---|
| 11 |  | 
|---|
| 12 | \section{Tasks} | 
|---|
| 13 | A \textcolor{ForestGreen}{task} behaves like a class object, but it maintains its own | 
|---|
| 14 | thread and execution state, which is the state information required to allow | 
|---|
| 15 | independent execution. A task provides mutual exclusion by default for calls to its | 
|---|
| 16 | public members. Public members allow communication among tasks. | 
|---|
| 17 |  | 
|---|
| 18 | \section{\uC Runtime Structure} | 
|---|
| 19 | \uC introduces two new runtime entities for controlling concurrent execution: | 
|---|
| 20 | \begin{itemize} | 
|---|
| 21 | \item Cluster | 
|---|
| 22 | \item Virtual processor | 
|---|
| 23 | \end{itemize} | 
|---|
| 24 |  | 
|---|
| 25 | \subsection{Cluster} | 
|---|
| 26 | A cluster is a group of tasks and virtual processors (discussed next) that | 
|---|
| 27 | execute tasks. The objective of a cluster is to control the amount of possible | 
|---|
| 28 | parallelism among tasks, which is only feasible if there are multiple | 
|---|
| 29 | hardware processors (cores). | 
|---|
| 30 |  | 
|---|
| 31 | At the start of a \uC program, two clusters are created. One is the system | 
|---|
| 32 | cluster and the other is the user cluster. The system cluster has a processor | 
|---|
| 33 | that only performs management work such as error detection and correction from | 
|---|
| 34 | user clusters, if an execution in a user cluster results in errors, and cleans | 
|---|
| 35 | up at shutdown. The user cluster manages and executes user tasks on its | 
|---|
| 36 | processors. The benefits of clusters are maximizing utilization of processors | 
|---|
| 37 | and minimizing runtime through a scheduler that is appropriate for a particular | 
|---|
| 38 | workload. Tasks and virtual processors may be migrated among clusters. | 
|---|
| 39 |  | 
|---|
| 40 | \subsection{Virtual Processor} | 
|---|
| 41 | A virtual processor is a software emulation of a processor that executes | 
|---|
| 42 | threads. Kernel threads are used to implement a virtual processor, which are | 
|---|
| 43 | scheduled for execution on a hardware processor by the underlying operating | 
|---|
| 44 | system. The operating system distributes kernel threads across a number of | 
|---|
| 45 | processors assuming that the program runs on a multiprocessor architecture. The | 
|---|
| 46 | usage of kernel threads enables parallel execution in \uC. | 
|---|