STACKS AND SYSTEM CALLS
• STACK:
• Data structure which stores data temporarily by piling one upon
another
• To access the data stored in stack, we use Last-in-First-out approach
• SYSTEM CALLS:
• Services or applications don’t need to know how certain functions in the
OS is implemented but rather call the function to carry out its task
HANDLING INTERRUPT
• Interrupt may originate from the Hardware, system events or the
OS
• An interrupt causes;
1. The processor to halt or interrupt executing the current
instructions
2. Call for an appropriate interrupt handler
MULTI THREADING
• This is the path taken by the process or a program during execution
• In multi-threading, tasks are divided into smaller pieces,
• Each piece is scheduled independently for the each other
• All the pieces are executed concurrently
• Threads can not be created endlessly
• The OS manages the number of threads created at a time to avoid
slowing down the processor
THREAD BASED VS EVENT-BASED
PROGRAMMING
• Thread based is fast while events based is slow
• Events based is executed to completion while Thread
based may not
MEMORY ALLOCATION
• In WSN has very limited memory that has to be used economically
• Reading and writing to memory is costly
• Since parallel buses are used between the processor and memory, it may
take some time
• Memory can be allocated statistically (requirement of memory is known
in advance) or dynamically (requirement of memory is not known in
advance)
NON FUNCTIONAL
ASPECTS
• Separation of concern
• System over head
• Portability
• Dynamic programming
SEPARATION OF CONCERN
• This is the separation between the operating system and the
application layer
• Its allows flexible and efficient programming and reconfiguration
• For example, a user orders to print a document and just waits
for the document to be printed without caring what takes place
between the computer and the printer hence separation of
concern
PORTABILITY
• Is it possible to run the same OS on different plat forms
• WSN may have different architecture for different nodes
• How easy is it for the said OS to be able to interact with
other types of OS
SYSTEM OVERHEAD
• This simply means the hardware required by the OS to perform
its tasks
• System overhead depends on;
1. The size of the operating system
2. The type of resources that the OS provides to the higher level
services and applications
DYNAMIC PROGRAMMING
• Once the WSN has been deployed, there is need to reprogram some parts of the
applications because;
1. The network may not perform optimally
2. The application requirement and the network operating surrounding can change
over time
3. Be necessary to detect and fix bugs
• NB: Manual replacement or reconfiguration may not be possible hence
dynamic programming recommended over WSN (Cloning)
DYNAMIC PROGRAMMING
• In principle:
• The implementation of dynamic programming should clearly separate between the
application and the operating system
• In practice:
• The OS can receive the software update and assemble or store it in memory
• OS makes sure this is indeed an updated version
• OS removes the piece of software that should be updated and installs and
configures a new version
TYPES OF OS IN WSN
1. TinyOS
2. Contiki
• Tiny OS:
• This is the most widely used and documented OS in WSN
1. Static memory allocation
2. An Event-based system
• TinyOS is developed for efficiency and not for flexibility
TINYOS ARCHITECTURE
• This architecture consist of;
1. A scheduler (FIFO)
2. A set of components which are classified into;
• Configuration components which defines how models are connected
to each other eg a whole software
• Modules: which is the basic building block of TinyOS program eg
section of a software. Apiece of software which does a specific task
• In TinyOS, components are structured in a hierarchical
manner and the way they communicate is highly defined
• However its best to define TinyOS as a run time
environment rather than an OS
• Higher components send commands to lower components
while lower components send out events upwards
• As a result, if you develop a module, you need to take care of events
handlers to handle evens coming from low level components and
command handlers to handle higher components
• For example, consider the two applications below;
• Networking application handling routing and the sensor application for
managing the sensor data
• In-between we see different types of modules
• A component or a module must have;
a) Frame
b) Command handler
c) Event handler
d) A set on non-pre-emptive tasks
LOGICAL DISTINCTIONS BETWEEN LOW LEVEL AND
HIGH LEVEL COMPONENTS
• Component /Module A:
• Sends out a command D1
• Meets an event D2
• Component /Module B:
• Uses all the services provided by component A
• Configuration Component /Module E:
• Helps to connect Component /Module A and Component /Module B (B.C=A.C)
means component B requires the services of interface C and interface C is
available in Module or component A
• A task: is the purpose for which a module is
built
• When this task is executed, it may issue a
command or an event
CONTIKI
• This is a hybrid OS
• It is an event driven and supports multithreading
• Programmed in C
• Designed for flexibility
• Its supports FIFO
TWO DIFFERENT CONFIGURATION OF CONTIKI
• Kernel helps to dispatch evens
• All other services have to register their
events at the kernel
STRUCTURE OF CONTIKI ENVIRONMENT
• From the above diagram we have Service 1 and service 2
• Service 2 may requires services offered by service 1
• Every installed service has to registered with the kernel
• The middle section means once the service is registered, it has to
provide all its functions that is provided
• Service 2 can me removed, updated without affecting service 1
PHYSICAL LAYER
PHYSICAL LAYER: WIRELESS SENSOR NETWORK
• The WSN is divided in to two sections
• The Node
• The Network
• Three blocks in the diagram:
• The middle block is responsible for relaying the packets when two
communicating devices can not communicate directly
• Dotted lines: represents logical communication which makes sure that
packets are received and forwarded to the right recipient
• Solid line: indicated the path a packet takes from the source to the
destination
• Physical Layer:
• protocols used to establish point to point connection
• MAC:
• protocol responsible for managing the wireless medium
• Ensures that packets are delivered between two communicating devices and sending an acknowledgement
• NET:
• Responsible for supporting multiple communication
• App
• Includes the application and transport layer
• Its responsible for prepares data in the form of packets for transmission
ADVANTAGES
• One of the advantages of WSN is the ability to communicate over a
wireless link.You don’t need a physical connection between devices
• Mobility of the sensor node can be supported. Eg a sensor on a
human body for a certain signal does not interfere with humans
moving from one place to another
• After deployment, its possible to rearrange the nodes to gain
efficiency, maximize power consumption etc
DISADVANTAGES
• There is limitation of range due to power supply
• The range of packet delivery is limited
• Surrounding noise from the environment do affect transmission
• NB: Due to all these challenges, we shall focus mainly on short
range point to point connection when dealing with the physical
layer
MAIN COMPONENT OF THE WIRELESS
COMMUNICATION SYSTEM
• 1. SOURCE ENCODING
• the main component of the digital communication system are;
1. The transmitter
2. The channel
3. The receiver
• Transmitter produces the packets and transmits them in form of
electromagnetic signals
• The electromagnetic signals propagates over electric channel
• The electromagnetic signals will be intercepted by the antenna of
the receiver and converted into the bit stream and the original
message will be reconstructed at the receiver end
• The main challenge is the channel because it distorts the
signal by introducing its own noise
• To avoid this, some devices have been developed to
combine the functionality of both the transmitter and
the receiver.
• They combine the namining hence Transceiver
DIGITAL COMMUNICATION SYSTEM
• Sensor: helps to generate data from the environment
• ADC:
• Need to convert from Analog signal to Digital signal because all the components
inside a WS node are digital system
• Channel encoder:
• makes sure that the signal we transmit over wireless network is robust to noise
• Ensure that the signal we propagate is incorruptible
• Modulator:
• Translates the digital video strings to analog signals because analog signals are
relatively easier to transmit than digital signals
• It translates the digital bit streams in such away that detections are easier
• Power amplifier
• For boosting the power of the signal being transmitted so that it can resist
attenuation, absorption etc
• When the signal is received at the receiver end, power may be low, the signal may
have been attenuated therefore;
• The signal is first amplified to an appreciable level
• Some conditioning circuit removes all undesirable signals, filters the signals and makes
it ready for subsequent digital processing
• The signal will go through the demodulator to separate the unwanted message from
the wanted message
• The message is then removed by channel decoder
• It goes through the source decoder reconstructs the signal before passing the
information to the sink (information sink)
WAYS TO TRANSFORM ANALOG SIGNAL TO DIGITAL
SIGNAL
• 1. Digital pulse code modulation (PCM)
• The Analog signal will be made discrete both in time and in
amplitude
• Each sample taken from analog will be mapped to discrete
highest level hence the binary digits (mapped to nearest discrete
value)
• 2. Delta Modulation
• transmits only the difference between the present sample and the
sample before it
• The differences is represented by either a one or a zero
• Digital pulse code modulation (PCM) and Delta Modulation
• are the two widely used encoding techniques to transform analog
signals to digital signals
• CHANNEL ENCODING
• When we transmit a signal over a wireless network, the signal can be corrupted,
interfered, absorption in the atmosphere etc
• The channel is expected to be able to make the signal to be robust
• The channel is expected to be able to detect error
• The channel is expected to be able to correct the errors
• In WSN, the main purpose of the channel encoder is to make the signal robust and to
detect the error
• For example
• Imagine a WSN being the corridor
• We wish to transmit a 3-dimensional object through this corridor
• Y-axis is the maximum amplitude the signal is permitted to pass through the corridor
• The width of the corridor represent the bandwidth of the channel
• Therefore, the message may either get chopped off or squeezed and some packets are
lost as it tries to pass through the corridor
• The only option would be to adjust the amplitude and the bandwidth
• Mathematically, we can represent it using the Shannon Hertley theorem which states
that the capacity of a channel to transmit a message without an error is given by
• Where
• C is the channel capacity in bits per second
• B is the bandwidth of the channel in hertz
• S is the average signal power over the entire bandwidth in watts
• N is the average noise power over the entire bandwidth in watts
• The equation sates that for data to be transmitted
free of errors, its transmission error should be
below the channel’s capacity
• It also indicates how the signal to noise ration
(SNR) can improve the channel’s capacity
HOW DO WE MEASURE THE OUTPUT OF NOISE
• When given the receiver
• Activate the receiver in the absence of no communication
• Measure the output of the receiving antenna
• Therefore, the output of this is the background noise level
• Again allow the receiver to receive useful packets
• The received power measured at the end of the antenna is the signal power
• The ratio will give us the signal to noise ratio
CHANNEL ENCODING
• The equation reveals two reasons why errors can be introduced during
transmission if;
1. Information will be lost if the message is transmitted at a rate higher than the
channel’s capacity ( this has a subtractive effect)
2. Information will be lost due to noise which adds irrelevant information into the
signal. If the noise level is too big energy is added to the electromagnetic signal
The design of the model will help quantify the impact of these two sources of
errors
ERROR RECOGNITION AND CORRECTION
• Error recognition
• When a transmitter is permitted to transmit only specific words
• If a channel decoder recognises unknown words;
• It corrects the error or request for a repeat transmission
• A decoder can correct only m number of errors,
• where m depends on the size of the word
• The channel encoder uses a codebook where each and every symbol to be trans mitted is represented by a
pattern
• If a pattern which is not know or which is not in the codebook is received, then we can tell that error has
occurred
• Error correction
• By sending n bits of information together with r control bits.
• The problem with this is that the extra r control bits slows
down the transmission
MODULATION
• Modulation transforms the digital bit stream of data to Analog signal for
transmission
• The Analog signal picked by a sensor is referred to as a baseband signal
• A baseband signal means the frequency of this signals is in the neighbourhood of
zero hertz (the bandwidth of the signal is significantly long)
• Frequency is inversely proportional to bandwidth
• The shorter the wavelength, the shorter the antenna hence direct proportional
relationship
• The antenna of a wireless sensor node should be very short. This means that the wave
length is also short. This would result to a higher frequency.
• However, the signals coming from the wireless sensor is a baseband signal with long
wave length
• This results into a problem that might have required a longer antenna yet the sensor
nodes don’t need long antennas
• To solve this problem, we bring in the modulator to transform the baseband signal into a
high frequency signal so that it is easier to detect these high frequency signals
• In doing this, we should not alter the intended signal
• Advantages
• The message signal will become resilient to noise
• The channel’s spectrum can be used effectively
• Signal detection will be simple
MODULATION TYPES
• Modulation can either be
• coherent or non-coherent modulator
• Coherent modulator:
• Means it requires a reference signal to retrieve the original signal
• Non-coherent modulator
• No reference signal required to demodulate the received signal
• A Modulator could be Binary or Q-ary
• Binary Modulator
• We have digital 0s or 1s to change either the frequency or the amplitude or the phase
• Q-ary Modulator
• We have a discrete magnitudes according to which the frequency or the amplitude or the phase changed
MEDIUM ACCESS CONTROL
(MAC)
• The Medium Access Control is designed to fulfil two essential
purposes in WSN;
1. To regulates the utilization of a shared medium
2. To manage the radio chip
If security is a critical component in the WSN, then the security model
should be implemented in the MAC. This is because it’s the MAC that
verifies the origin of the packets received before forwarding them
MEDIUM ACCESS LAYER
• Basic parameters to determine the performance of the MAC
• Energy performance: MAC is responsible for initiating and completing the transmission of a packet
hence the time needed to transmit a packet has direct bearing on energy consumption per packet
• Latency: Time needed to successfully complete a transaction
• Scalability:
• Network size: if the size of a network changes how does the MAC respond to it
• Node density: if the number of the neighbouring nodes changes, how does MAC respond to this
change
• Topology: if the topology of the network changes, how does MAC respond to this change
• Channel utilization: defines the number of useful packets transmitted
through the channel within a given time
• Throughput (packets per second): defines stability of the wireless.
• Fairness: it looks at all nodes to be independent and each node should
have a fair share of the medium
• In WSN, the whole network belongs to a given application. The need of
this application dictate which nodes should communicate and when
they should communicate
• Energy can be wasted in three different ways
• Collision: the poorer the MAC protocol, the more frequent the Collison
occur on the transmission medium. To control this, nodes use handshake
where they agree on the communication by exchanging packets.
• Idle listening: when the radio is not communicating yet all its components are
active. This means current if flowing through them and energy is being
consumed
• Over hearing: a node receives packets destined for another node
MEDIUM ACCESS CONTROL PROTOCOL
1. TDMA (Time Division Multiple Access)
2. CSMA (Carrier Sense Multiple Access)
• TDMA
• This could be discussed when dealing with schedulers or scheduling algorithm
• Time is allocated to each node on when to communicate however they are not
stopped from listening from other nodes
• If we have N neighbours to communicate with then we also need N time slots for
communication
• This requires a centralised node which allocates time slots to the nodes to enable
communication
• CSMA
• It makes use of the rule that if you want to talk, first listen to
the medium and be sure that no one is talking before you
start communicating.
• No dedicated node will inform you about the communication
• Makes use of the distributed algorithm