## 2 A General Overview on SSNs
### SSNs Architecture
#### 2.4.1 SSNs Node Architecture  
Although there were not enough proposals that describe the sensor node structure in a shared environment, except in [18], which described it from the aspect of protocol stack. Thus we decided to tackle this track, as shown in Figure 2 shows the proposal for main layers of a SSN's sensor node architecture, the lower layer consists of the physical sensor resources, such as a Central Processing Unit (CPU), Radio Frequency (RF) module, memory module, and power module. Layer 2 contains the available sensor operating system.  
The hypervisor layer allows managing, abstracting, virtualizing, and customizing sensing resources that the sensor could provide. It consists of virtualization softwares, like Virtual Machine (VM) or MiddleWare (MW), and the virtualization manager, like service, resource discovery managers and energy and security managers. The virtualization software deals with abstracting the hardware resources details from the running application and the virtualization manager is responsible for managing the services and resources that are provided by the sensor node.  
Each one of virtualization techniques uses different programming models and different task execution models to achieve concurrent applications over the same sensor node. Initially, we will provide a brief explanation for them. Figure 3 displays the main models for both task execution and the programming models used in node virtualization.  
Firstly, the programming models are event-driven, thread based and Mobile agent, as in Figure 3. In the case of the event-driven programming model, the main program in the OS waits for the occurrence of the designed event threshold, which triggers the matching event-handle function that is registered at the OS scheduler, and when an I/O event stops the program, the event-handle function returns the control to the main program without context switching. However, in the case of the thread based programming model, each program contains multiple threads, and when a thread is blocked by any I/O device, it will suspend and need context switching to execute other threads. Therefore, the thread based model is more complex in programming and more difficult to be implement in sensor nodes than the event-driven model. The mobile agent programming model was presented in [19], where it was considered as a special process that can autonomously migrate across nodes by one of two ways, the first one is strong where the migration process transfers both the code and state, allowing for the agent to resume execution at the destination. The second is weak where the migration process only transfers the code, which is to support the diversity of the applications' requirements.  
Figure 3: Task Execution and programming Models for the sensor virtualization.  
Figure 2: Proposed SSN Node Architecture.  
As for task execution models, there are two ways, either sequential or parallel execution. The sequential tasks model involves a consecutive and ordered execution of tasks one after another, while the Parallel tasks model involves the concurrent or simultaneous execution of tasks or threads at the same time. Although sequential execution has a simple implementation, it is considered to be a weak form of virtualization, because tasks have to wait in a queue, but in parallel execution the tasks are executed in time-slices by rapidly switching the context from one task to another, which will give faster task execution and there is no need to wait for the finishing large tasks, but it needs more complex programming codes.