Unit 2 Part 3
Unit 2 Part 3
https://referenceglobe.com/CollegeLibrary/library_books/2018
0226061001computers-as-components-principles-of-embedded-com
puting-system-design-2nd-edition-wayne-wolf-elsevier-2008-%5
Bbookspar.com%5D.pdf
1. Tasks and Processes
1. Tasks and Processes
Example of Compressor
Explanation
● The device connects to serial ports on both ends, taking in uncompressed bytes as input.
● It outputs compressed bits based on a predefined compression table.
● It's commonly used to compress data before sending it to a modem.
● Programs may need to handle different rates of receiving and sending data, such as emitting 2 bits for the first byte
and then 7 bits for the second byte.
● This rate difference influences the structure of the code.
● An elegant solution involves creating a queue for output bits, which are sent to the serial port in sets of 8 bits.
● Besides organizing the code's control structure, it's crucial to manage input and output rates properly.
● Spending too much time on output packaging might lead to dropping input characters, presenting a timing challenge
to solve.
Explanation
● The compression box and a control panel on a machine demonstrate rate control problems.
● The compression box's control panel may have a compression mode button to enable or disable compression.
● Pressing the compression mode button can happen asynchronously compared to character arrivals.
● Buttons are pressed much less frequently than characters are received.
● Managing input/output while monitoring the button can lead to complex control code.
● Sampling the button too slowly might miss button depressions, while sampling too frequently can cause incorrect
data compression.
● One solution involves using a counter in the main compression loop to check the button periodically.
● However, this solution fails if either the compression loop or the button-handling routine has variable execution
times, leading to potential data loss.
● Processes allow for separate handling of tasks with different timing requirements, addressing these control
challenges.
● These examples highlight how timing and execution rate requirements can complicate programming, leading to
complex control structures that are challenging to verify for functionality and timing properties.
2. Multi rate systems
● Processes can have several different types of timing requirements imposed on them by the
application.
● The timing requirements on a set of processes strongly influence the type of scheduling
that is appropriate.
● A scheduling policy must define the timing requirements that it uses to determine whether
a schedule is valid
● The release time is the time at which the process becomes
ready to execute; this is not necessarily the time at which it
actually takes control of the CPU and starts to run.
○ An aperiodic process is by definition initiated by an
event, such as external data arriving or data
computed by another process. The release time is
generally measured from that event.
○ For a periodically executed process, there are two
common possibilities. In simpler systems, the
process may become ready at the beginning of the
period.
○ More sophisticated systems, such as those with data
dependencies between processes, may set the release
time at the arrival time of certain data, at a time after
the start of the period.
● A deadline specifies when a computation must be finished.
○ The deadline for an aperiodic process is generally
measured from the release time, since that is the
only reasonable time reference.
○ The deadline for a periodic process may in general
occur at some time other than the end of the period.
● A set of processes with data
dependencies is known as a task
graph.
● consider a component of the task
graph (a set of nodes connected by
data dependencies) as a task and the
complete graph as the task set
● The two tasks ({P1, P2, P3, P4} and
{P5, P6}) have no timing
relationships between them.
● Communication among processes that
run at different rates cannot be
represented by data dependencies
because there is no one-to-one
relationship between data coming out
of the source process and going into
the destination process.
4. CPU Metrics
● The initiation time is the time at which a process
actually starts executing on the CPU. The completion time
is the time at which the process finishes its work.
5. Process State and Scheduling
● Cyclostatic schedule is divided into
❖ Preemption is an alternative to the C function call as a way to control execution.To be able to take full
advantage of the timer.
❖ The kernel is the part of the OS that determines what process is running. The kernel is activated periodically
by the timer. The length of the timer period is known as the time quantum because it is the smallest
increment in which we can control CPU activity.
❖ The kernel determines what process will run next and causes that process to run. On the next timer interrupt,
the kernel may pick the same process or another process to run.
❖ The set of registers that define a process are known as its context and switching from one process’s register
set to another is known as context switching. The data structure that holds the state of the process is known
as the process control block.
Priorities - to decide which process to pick