[ Pobierz całość w formacie PDF ]
.The third major component of LiteOS is the Kernel that resides on the sensor node.TheLiteOS kernel provides concurrency in the form of multithreading, provides support for dynamicSensors 2011, 11 5922loading, uses round robin and priority scheduling, allows programmers to register event handlersthrough callback functions, and provides synchronization support.Figure 6 shows the architectureof LiteOS.Figure 6.LiteOS Architecture.File SystemUser Environment KernelLiteFSInstalled on BS Sensor NodeNetwork ViewLiteShellMulti-DevicethreadedDriversKernelDataCacheData BinaryFiles InstallerCommandProcessorUser System CallApplications ServicesSessionState8.2.Programming ModelLiteOS is a multitasking OS and it supports multithreading.In LiteOS, processes run applications asseparate threads.Each thread has its own memory space to avoid potential semantic errors that couldoccur during read and write in shared memory space.LiteOS also provides support for event handling.Application programmers can register event handlers using a callback facility provided by LiteOS.To avoid potential race conditions, LiteOS provides atomic_start() and atomic_end() functions.Whenever shared data among different threads is accessed or modified, it is highly recommend to usethese functions.The LiteOS documentation does not detail how this functions are internallyimplemented, i.e., whether they are disabling interrupts or using mutexes.8.3.SchedulingLiteOS provides an implementation of Round Robin scheduling and Priority-based scheduling.Whenever a task is added to the ready queue, the next task to be executed is chosen throughpriority-based scheduling.The tasks run to completion or until they request a resource that is notcurrently available.When a task requires a resource that is not available, the task enables interruptsand goes to sleep mode.Once the required resource becomes available, the appropriate interrupt issignaled and the task resumes it execution from where it had left.When a task completes its operationit leaves the kernel.Sensors 2011, 11 5923When there are no active tasks in the system, the sensor node goes to sleep mode.Before going tosleep mode the node enables its interrupts so that it can wake up at the proper event or time.Since the LiteOS scheduler allows tasks to run until completion, there is a chance that a higherpriority task enters the ready queue when a low priority task is completing its execution.In thisscenario, a higher priority task may miss its deadline, therefore LiteOS is not an appropriate OS forreal-time sensor networks.8.4.Memory Protection and ManagementInside the kernel, LiteOS supports dynamic memory allocation through the use of C-like malloc andfree functions.User applications can use these APIs to allocate and de-allocate memory at run-time.Dynamic memory grows in the opposite direction of the LiteOS stack.The dynamic memory isallocated from the unused area between the end of the kernel variables and the start of the userapplication memory blocks.This allows adjusting the size of dynamic memory as required bythe application.The LiteOS kernel compiles separately from the application, therefore the address space is notshared between the kernel and the application.Similarly, each user application has its separate addressspace.Processes and Kernel memory safety is enforced through separate address spaces.8.5.Communication Protocol SupportLiteOS provides communication support in the form of files.LiteOS creates a file corresponding toeach device on the sensor node.Similarly, it creates a file corresponding to the radio interface.Whenever there is some data that needs to be sent, the data is placed into the radio file and is afterwardwirelessly transmitted.In the same manner, whenever some data arrives at the node it is placed in theradio file and is delivered to the corresponding application using the port number present in the dataAt the network layer LiteOS supports geographical forwarding.Each node contains a table that canonly hold 12 entries.This routing protocol is supported in LiteOS version 0.3.Unfortunately, detaileddocumentation on communication protocols supported by LiteOS is not available, hence there has beenno indication about the protocols supported at the MAC, network and transport layer.8.6.Resource SharingLiteOS suggest the use of APIs provided for synchronization whenever a thread wants to accessresources that are shared by multiple threads.The LiteOS documentation does not provide any detailon how system resources are shared among multiple executing threads.8.7.Support for Real-Time ApplicationsLiteOS does not provide any implementation of networking protocols that support real-timemultimedia applications.It provides a priority-based process scheduling algorithm but once a processis scheduled it runs to completion.This can result in a missed deadline of a higher priority process thatenters the ready queue once a low priority process has been scheduled.Sensors 2011, 11 59248.8
[ Pobierz całość w formacie PDF ]