Revision 1.6 March 26, uc/os RTOS Library

Size: px
Start display at page:

Download "Revision 1.6 March 26, uc/os RTOS Library"

Transcription

1 Revision 1.6 March 26, 2010 uc/os RTOS Library

2 Table of Contents 1. Introduction Function Summary OSTaskCreate OSTaskCreatewName OSSimpleTaskCreate (MACRO) OSSimpleTaskCreatewName (MACRO) OSTaskDelete OSChangePrio OSTimeDly OSChangeTaskDly OSLock OSUnlock OSLockObj OSSemInit OSSemPost OSSemPend OSSemPendNoWait OSMboxInit OSMboxPost OSMboxPend OSMboxPendNoWait OSQInit OSQPost OSQPostFirst OSQPend OSQPendNoWait OSFifoInit OSFifoPost OSFifoPostFirst OSFifoPend OSFifoPendNoWait OSCritInit OSCritEnter OSCritEnterNoWait OSCritLeave Examples Example # Example # OSIntEnter OSIntExit USER_ENTER_CRITICAL USER_EXIT_CRITICAL OSDumpTCBStacks

3 2.40. OSDumpTasks ShowTaskList OSFlagCreate OSFlagSet OSFlagState OSFlagClear OSFlagPendAll OSFlagPendAllNoWait OSFlagPendAny OSFlagPendAnyNoWait

4 1. Introduction The NetBurner uc/os RTOS is a preemptive multitasking real-time operating system designed to be very efficient and full featured, providing rapid real-time response and a small footprint. You can easily create and manage multiple tasks and communicate between tasks. The RTOS is integrated with the I/O system to make communication with the other system components, such as the TCP/IP Stack (not applicable for the non-network platforms such as the Mod5213), quick and easy. Required Header Files #include <ucos.h> Location depends on your NetBurner platform: \nburn\include, \nburn\incluse_nn or \nburn\include_sc. 2. Function Summary Task Functions OSTaskCreate -- Creates a new task OSTaskCreateName --- Creates a new task and assigns it a name (test string) OSSimpleTaskCreate --- A macro that sets up the stack and starts the task at the proper priority OSSimpleTaskCreateName --- Same as OSSimpleTaskCreate, but adds a name (text string) OSTaskDelete --- Deletes a task OSChangePrio --- Changes a tasks priority Time Delay Functions OSTimeDly --- Delay or sleep for a fixed interval OSChangeTaskDly --- Changes the interval for a waiting task Task Locking Functions OSLock --- Locks the OS and prevents task switches OSUnlock --- Unlocks the OS OSLockObj --- A C++ class to make task locking easy Semaphore Functions OSSemInit --- Initializes an OS_SEM structure OSSemPost --- Post to a semaphore OSSemPend --- Pend on a semaphore OSSemPendNoWait --- Pend on a semaphore without waiting 4

5 Mail Box Functions OSMboxInit --- Initializes an OS_MBOX structure OSMboxPost --- Post to a mailbox OSMboxPend --- Pend on a mailbox OSMboxPendNoWait --- Pend on a mailbox without waiting Queue Functions OSQInit --- Initializes an OS_QUEUE structure OSQPost --- Post to a queue OSQPend --- Pend on a queue OSQPendNoWait --- Pend on a queue without waiting FIFO Functions OSFifoInit --- Initializes an OS_FIFO structure OSFifoPost --- Post to a fifo OSFifoPostFirst --- Post to the head of a fifo OSFifoPend --- Pend on a fifo OSFifoPendNoWait --- Pend on a fifo without waiting OS Critical Functions The OS_CRIT and related functions implement an OS function referred to as a mutex or counted critical section. Their purpose is to provide a mechanism to protect critical data with a structure or resource. Some examples of its use would be to protect the data in a linked list, or to control an external command interface. You will want to use this kind of critical section when you need to keep one task from interrupting another task when doing manipulations in a set. OSCritInit --- Initializes the critical section OSCritEnter --- Tries to enters or claim the critical section OSCritEnterNoWait --- Tries to enter or claim the critical section without waiting OSCritLeave --- Releases the critical section Two Examples Interrupt Functions OSIntEnter and OSIntExit are taken care of in the INTERRUPT Macro for all NetBurner Platforms. For more information, please read the Interrupts section in NetBurner Runtime Libraries User s Manual (in C:\Nburn\docs\NetBurnerRuntimeLibrary). OSIntEnter --- Must be called when a user interrupt is entered OSIntExit --- Must be called when a user interrupt is exited 5

6 User Critical Functions These function like a level 7 interrupt. Important: You will have full processor time once you enter the section, but all uc/os functions and features will be disabled until you exit the section. All hardware peripherals interrupts will also be disabled. USER_ENTER_CRITICAL --- Sets a level 7 interrupt mask when entered USER_EXIT_CRITICAL --- Sets the interrupt mask to the value before critical section was entered Debugging Functions The debugging routines are only valid when UCOS_STACK_CHECK is defined. OSDumpTCBStacks --- Dumps all of the task stack information to stdout OSDumpTasks --- Dumps all of the task info to stdout Flag Functions OSFlagCreate ---Creates and initializes an OS_FLAGS object OSFlagSet --- Sets the bits asserted bits_to_set OSFlagState ---Returns the current value of flags OSFlagClear --- Clears the bits asserted in bits_to_clr OSFlagPendAll ---- Waits until all of the flags indicated by mask are set OSFlagPendNoWait --- Checks (but does not wait) if all of the flags indicated by the mask are set OSFlagPendAny --- Waits until any of the flags indicated by the mask are set OSFlagPendAnyNoWait ---Checks (but does not wait) if any of the flags indicated by the mask are set 6

7 2.1. OSTaskCreate BYTE OSTaskCreate( void ( * task )( void * taskfunc ), void * data, void * pstacktop, void * pstackbot, BYTE priority ); This function creates a new task. You must allocate storage for the stack that this new task will use and it must be 4 byte aligned. Task priorities can range from 1 to 63, where 63 is the lowest priority level and 1 is highest priority level. The recommended user priority levels for your application are in the range of 46 to 62. This avoids any conflicts with network communications. Warning: The uc/os can only have one task at each priority. Type taskfunc data pstacktop pstackbot priority Description The address of the function where this task will start executing. The data to pass to the task function. The highest address of the stack space. The lowest address of the stack space. The priority for this new task (63 is lowest priority and 1 is highest). Look in C:\Nburn\include\constants.h to see which priorities are used by the OS. For non-network platforms (e.g. Mod5213), look in C:\Nburn\include_nn\constants.h to see which priorities are used by the OS. OS_NO_ERR (0) --- If successful OS_PRIO_EXIST (40) --- If the requested priority already exists OSTaskDelete --- Delete a task OSChangePrio --- Change a task's priority OSSimpleTaskCreate --- A macro that sets up the stack and starts the task at the proper priority 7

8 Example: // Make sure they're 4 byte aligned to keep the Coldfire happy asm( ".align 4 " ); DWORD MyTaskStk[USER_TASK_STK_SIZE] attribute ( ( aligned( 4 ) ) ); // The function the new task will start in. pdata will have the value // of my_data as provided in the OSTaskCreate Call void mytask(void * pdata) { } if (OSTaskCreate(mytask, (void*)my_data, (void*)&mytaskstk[user_task_stk_size], (void *)MyTaskStk, MyPrio )!=OS_NO_ERR) { // Handle error } 8

9 2.2. OSTaskCreatewName BYTE OSTaskCreatewName( void ( *task ) ( void *dptr ), void *data, void *pstktop, void *pstkbot, BYTE prio, const char * name); Only available on select network platforms. Located in \nburn\include directory. Same as OSTaskCreate, but adds a name that can be assigned to the task, which makes it easier to identify the task when using the debugger, Task Scan or Smart Traps. 9

10 2.3. OSSimpleTaskCreate (MACRO) OSSimpleTaskCreate( function, priority ); This Macro sets up the stack and starts the task at the proper priority. For example, if I want to start a task called "my_task", I would use the OSSimpleTaskCreate macro as follows: void my_task( void *) { The my_task function } OSSimpleTaskCreate( my_task, MAIN_PRIO-1 ); Type function priority Description The address of the function where this task will start executing. The priority for this new task (63 is lowest priority, 1 is highest). Look in C:\Nburn\include\constants.h to see which priorities are used by the OS. For non-network platforms (e.g. Mod5213), look in C:\Nburn\include_nn\constants.h to see which priorities are used by the OS. OSTaskCreate --- Create a new task OSTaskDelete --- Delete a task OSChangePrio --- Change a task's priority 10

11 2.4. OSSimpleTaskCreatewName (MACRO) OSSimpleTaskCreate( function, priority, name ); Only available on select network platforms. Located in \nburn\include directory. Same as OSTaskCreate, but adds a name that can be assigned to the task, which makes it easier to identify the task when using the debugger, Task Scan or Smart Traps. void my_task( void *) { The my_task function } OSSimpleTaskCreate( my_task, MAIN_PRIO-1, My Task ); 11

12 2.5. OSTaskDelete void OSTaskDelete( void ); This function deletes the current calling task, but we do not recommend the use of this function because it can cause memory leaks. The preferred method for terminating a task is to set a flag or semaphore that the task is listening for. The flag can then be set by an outside task, which enables the task to be deleted to free any resources and terminate gracefully by simply returning. None Nothing --- This is a void function OSTaskCreate --- Create a new task OSSimpleTaskCreate --- A macro that sets up the stack and starts the task at the proper priority OSChangePrio ---Change a task's priority 12

13 2.6. OSChangePrio BYTE OSChangePrio( BYTE newpriority ); This function changes the priority of the calling task. Note: The uc/os can only have one task at each priority level. Task priorities can range from 1 to 63, where 63 is the lowest priority level and 1 is highest priority level. Priorities 1-4 and the NetBurner system priority levels are reserved as described below. The recommended user priority levels for your application are in the range of 46 to 62. This avoids any conflicts with network communications. System priorities are defined in C:\Nburn\include\constants.h for all network platforms and in C:\Nburn\include_nn\constants.h for all non-network (e.g. Mod5213) platforms. #define MAIN_PRIO (50) #define HTTP_PRIO (45) #define PPP_PRIO (44) #define TCP_PRIO (40) #define IP_PRIO (39) #define ETHER_SEND_PRIO (38) Parameter: BYTE newpriority The new priority of the calling task. OS_NO_ERR (0) --- If successful OS_PRIO_EXIST (40) --- If the requested priority already exists OSTaskCreate --- Create a new task OSTaskDelete --- Delete a task OSSimpleTaskCreate --- A macro that sets up the stack and starts the task at the proper priority 13

14 2.7. OSTimeDly void OSTimeDly( WORD ticks ); This function delays this task for "ticks" ticks of the system timer. Remember: The number of ticks per second is defined by the constant TICKS_PER_SECOND. Parameter: WORD ticks The number of ticks per second Nothing --- This is a void function OSChangeTaskDly --- Change the interval for a waiting task Example: OSTimeDly( 5*TICKS_PER_SECOND ); // Delay for 5 seconds 14

15 2.8. OSChangeTaskDly void OSChangeTaskDly( WORD task_prio, WORD newticks ); This function allows the User to modify the timeout delay for a task that is waiting. Warning: Use of this function is discouraged. WORD task_prio The task's priority. WORD newticks The new number of ticks per second. Nothing --- This is a void function OSTimeDly --- Delay or Sleep for a fixed interval OSSemPend --- Pend on a semaphore OSMboxPend --- Pend on a mailbox OSQPend --- Pend on a queue OSFifoPend --- Pend on a fifo 15

16 2.9. OSLock void OSLock( void ); Calling the OSLock function will prevent the OS from changing tasks. This is used to protect critical variables that must be accessed one task at a time. Use the OSUnlock function to release your lock. Important: You must call OSUnlock once for each call to OSLock. Warning: Do not keep a task locked for long period of time, or the performance of the network subsystem will degrade, and eventually loose packets. None Nothing --- This is a void function OSUnlock --- Unlocks the OS OSLockObj --- A C++ class to make task locking easy 16

17 2.10. OSUnlock void OSUnlock( void ); This function unlocks the OS. Important: You must call OSUnlock once for each call to OSLock. None Nothing --- This is a void function OSLock --- Locks the OS and prevent task switches OSLockObj --- A C++ class to make task locking easy 17

18 2.11. OSLockObj class OSLockObj { public: OSLockObj(); ~OSLockObj(); }; A simple C++ wrapper class that helps use OS locks effectively. When an OSLockObj is constructed it locks the OS. When it is destructed it unlocks the OS. If you have a function that needs an OS lock and has multiple points of exit, create an OSLockObj at the beginning of the function. Important: No matter how you leave the function, the destructor will release the lock. Example: int foo() { // The destructor will unlock the OS when lock goes out of scope OSLockObj lock;... if () return 1;... if () return 3; if () return 0; } OSLock --- Locks the OS and prevents task switches OSUnlock --- Unlocks the OS 18

19 2.12. OSSemInit BYTE OSSemInit( OS_SEM * psem, long value ); Semaphores are used to control access to shared resource, or to communicate between tasks. This function is used to initialize a semaphore structure. Note: This must be done before using a semaphore. OS_SEM *psem A pointer to the OS_SEM structure to initialize. long value The initial count value for the semaphore. OS_NO_ERR (0) --- If successful OS_SEM_ERR (50) --- If value is < 0 (zero), it cannot initialize Example: OS_SEM MySemaphore;.. OSSemInit(& MySemaphore,0);.. // In a different task/function... OSSemPost(& MySemaphore); // Add one to the semaphores value.. // In a yet another different task/function... // Wait 5 seconds or until the semaphore has a positive value // Decrement the semaphore if we don't timeout... if (OSSemPend(& MySemaphore, 5*TICKS_PER_SECOND)==OS_TIMEOUT){// We timed out the 5 seconds}else {// We got the semaphore} OSSemPost --- Post to a semaphore OSSemPend --- Pend on a semaphore 19

20 2.13. OSSemPost BYTE OSSemPost( OS_SEM * psem ); This function increases the value of the semaphore by one. Note: If any higher priority tasks were waiting on the semaphore - it releases them. Parameter: OS_SEM *psem A pointer to the OS_SEM structure to initialize. OS_NO_ERR (0) --- If successful OS_SEM_OVF (51) --- If the value of the semaphore overflows OSSemInit --- Initialize an OS_SEM structure OSSemPend --- Pend on a semaphore 20

21 2.14. OSSemPend BYTE OSSemPend( OS_SEM * psem, WORD timeout ); Wait timeout ticks for the value of the semaphore to be non zero. Note: A timeout value of 0 (zero) waits forever. OS_SEM *psem A pointer to an OS_SEM structure. WORD timeout The number of time ticks to wait. OS_NO_ERR (0) --- If successful OS_TIMEOUT (10) --- If the function timed out or if the NoWait function failed OSSemInit --- Initialize an OS_SEM structure OSSemPendNoWait --- Does not wait for the value of the semaphore to be non zero OSSemPost --- Post to a semaphore 21

22 2.15. OSSemPendNoWait BYTE OSSemPendNoWait( OS_SEM * psem ); OSSemPendNoWait is identical to the OSSemPend function, but it does not wait. Parameter: OS_SEM *psem A pointer to the OS_SEM structure. OS_NO_ERR (0) --- If successful OS_TIMEOUT (10) --- If it fails OSSemInit --- Initialize an OS_SEM structure OSSemPend --- Pend on a semaphore OSSemPost --- Post to a semaphore 22

23 2.16. OSMboxInit BYTE OSMboxInit( OS_MBOX * pmbox, void * msg ); Mailboxes are used to communicate between tasks. This function is used to initialize an OS_MBOX structure. Note: This must be done before using the mailbox. OS_MBOX *pmbox A pointer to the OS_MBOX structure to initialize. void *msg The initial mail box message (NULL) for none. OS_NO_ERR (0) --- If successful Example: OS_MBOX MyMailBox; OSMboxInit(& MyMailBox,0); // In a different task/function... // Put a message in the Mailbox. OSMboxPost(& MyMailBox, (void *)somevalue); // In a yet another different task/function... // Wait 5 seconds or until the mailbox has a message BYTE err; void * pdata=osmboxpend(& MyMailBox, 5*TICKS_PER_SECOND,&err); if (pdata==null) { // We timed out the 5 seconds } else { // We got the message } OSMboxPend --- Pend on a mailbox OSMboxPost --- Post to a mailbox OSSemPendNoWait --- Does not wait for the value of the semaphore to be non zero 23

24 2.17. OSMboxPost BYTE OSMboxPost( OS_MBOX * pmbox, void * msg ); This function posts a message to a Mail box. OS_MBOX *pmbox A pointer to an OS_MBOX structure. void *msg The message to post. OS_NO_ERR (0) --- If successful OS_MBOX_FULL (20) --- If the mailbox is full OSMboxInit --- Initialize an OS_MBOX structure OSMboxPend --- Pend on a Mailbox OSSemPendNoWait --- Does not wait for the value of the semaphore to be non zero 24

25 2.18. OSMboxPend void * OSMboxPend( OS_MBOX * pmbox, WORD timeout, BYTE * err ); Wait timeout ticks for some other task to post to the Mailbox. Note: OSMboxPend will wait forever if 0 (zero) is specified. OS_MBOX *pmbox A pointer to an OS_MBOX structure. WORD timeout The number of time ticks to wait. Byte *err A variable to receive the result code. The posted message NULL --- If the function timed out Note: err can have either OS_NO_ERR or OS_TIMEOUT return codes. OSMboxInit --- Initialize an OS_MBOX structure OSMboxPendNoWait --- Does not wait for some other task to post to the Mailbox OSMboxPost --- Post to a Mailbox 25

26 2.19. OSMboxPendNoWait void * OSMboxPendNoWait( OS_MBOX * pmbox, BYTE * err ); OSMboxPendNoWait is identical to the OSMboxPend function, but it does not wait. OS_MBOX *pmbox A pointer to an OS_MBOX structure. Byte *err A variable to receive the result code. The posted message NULL --- If it fails Note: err can have either OS_NO_ERR or OS_TIMEOUT return codes. OSMboxPend --- Pend on a Mailbox OSMboxPendNoWait --- Does not wait for some other task to post to the Mailbox OSMboxPost --- Post to a Mailbox 26

27 2.20. OSQInit BYTE OSQInit( OS_Q * pq, void * * start, BYTE siz ); A queue functions as a fixed size FIFO for communication between tasks. This function initializes an OS_Q structure. OS_Q *pq A pointer to an OS_Q structure. void **start A pointer to an array of (void *) pointers to hold queue messages. BYTE siz The number of pointers in the Q data storage area. OS_NO_ERR (0) --- If successful Example: OS_Q MyQueue; void * MyQueueStorage[NUM_ELEMENTS]; OSQInit(& MyQueue,MyQueueStorage,NUM_ELEMENTS); // In a different task/function... // Put a message in the Queue OSQPost(& MyQueue, (void *)somevalue); // In a yet another different task/function... // Wait 5 seconds or until the queue has a message. BYTE err; void * pdata=osqpend(& MyQueue, 5*TICKS_PER_SECOND,&err); if (pdata==null) {// We timed out the 5 seconds } else {// We got the message } OSQPost --- Post to a Queue OSQPend --- Pend on a Queue OSQPendNoWait --- Does not wait for another task to post to the queue 27

28 2.21. OSQPost BYTE OSQPost( OS_Q * pq, void * msg ); This function posts a message to a Queue. Note: Any higher priority task waiting on this queue will be started. OS_Q *pq A pointer to an OS_Q structure. void *msg The message to be posted to the queue. OS_NO_ERR (0) --- If successful OS_Q_FULL (30) --- If the queue is full and has no more room OSQInit --- Initialize an OS_QUEUE structure OSQPend --- Pend on a Queue OSQPendNoWait --- Does not wait for another task to post to the queue 28

29 2.22. OSQPostFirst BYTE OSQPostFirst( OS_Q *pq, void *msg ); This function posts a message like OSQPost, but posts the message at the head of the queue. Note that any higher priority task waiting on this queue will be started. OS_Q *pq A pointer to an OS_Q structure. void *msg The message to post at the head of the queue. OS_NO_ERR (0) --- Successfully posted at the head of the queue. OS_Q_FULL (30) --- The queue is already full; cannot post message. OSQInit --- Initialize an OS_Q structure. OSQPost --- Post to a queue. OSQPend --- Pend on a queue. OSQPendNoWait --- Does not wait for another task to post to the queue. 29

30 2.23. OSQPend void * OSQPend( OS_Q * pq, WORD timeout, BYTE * err ); Wait timeout ticks for another task to post to the queue. Note: A timeout value of 0 (zero) waits forever. An err holds the error code if the function fails. OS_Q *pq A pointer to an OS_Q structure. WORD timeout The number of time ticks to wait. BYTE *err A variable to receive the result code. The posted message NULL --- If the function failed Note: err can have OS_NO_ERROR or OS_TIMEOUT return codes OSQInit --- Initialize an OS_QUEUE structure OSQPendNoWait --- Does not wait for another task to post to the queue OSQPost --- Post to a Queue 30

31 2.24. OSQPendNoWait void * OSQPendNoWait( OS_Q * pq, BYTE * err ); OSQPendNoWait is identical to the OSQPend function but it does not wait. OS_Q *pq A pointer to an OS_Q structure. BYTE *err A variable to receive the result code. The posted message NULL --- If the function failed Note: err can have OS_NO_ERROR or OS_TIMEOUT return codes OSQPend --- Pend on a Queue OSQInit --- Initialize an OS_QUEUE structure OSQPost --- Post to a Queue 31

32 2.25. OSFifoInit BYTE OSFifoInit( OS_FIFO * pfifo ); A FIFO is used to pass structures from one task to another. Note: The structure to be passed must have an unused (void *) pointer as its first element. This precludes passing C++ objects with virtual member functions. Parameter: OS_FIFO *pfifo A pointer to an OS_FIFO structure. OS_NO_ERR (0) --- If successful OSFifoPost --- Post to a fifo OSFifoPostFirst --- Post to the head of a fifo OSFifoPend --- Pend on a fifo OSFifoPendNoWait --- Pend on a fifo without waiting Example: OS_FIFO MyFifo; typedef struct {void * pusedbyfifo; // Don't modify this value, and keep it first // The other elements in my structure }MyStructure; OSFifoInit(& MyFifo); // In a different task/function... MyStructure mydata; // Put a message in the Fifo OSFifoPost(& MyFifo, (OS_FIFO_EL *)&mydata); // In yet another different task/function... // Wait 5 seconds or until the Fifo has a object BYTE err; MyStructure * pdata= (MyStructure *)OSFifoPend(& MyQueue, 5*TICKS_PER_SECOND); if (pdata==null) {// we timed out the 5 seconds} 32

33 else {// We got the object } 33

34 2.26. OSFifoPost BYTE OSFifoPost( OS_FIFO * pfifo, OS_FIFO_EL * ptopost ); This function posts to a FIFO. Note: See the description of FIFOs in OSFifoInit for details on how to use this function. OS_FIFO *pfifo A pointer to an OS_FIFO structure. OS_FIFO_EL *ptopost A pointer to the user's structure cast as an OS_FIFO_EL to be posted to the Fifo. OS_NO_ERR (0) --- If successful OSFifoInit --- Initialize an os_fifo structure OSFifoPostFirst --- Post to the head of a fifo OSFifoPend --- Pend on a fifo OSFifoPendNoWait --- Pend on a fifo without waiting 34

35 2.27. OSFifoPostFirst BYTE OSFifoPostFirst( OS_FIFO * pfifo, OS_FIFO_EL * ptopost ); This function is identical to OSFifoPost (post to a FIFO), but the element posted is put on the beginning of the FIFO list. So, the task that pends next will get the structure/object posted here, instead of any prior objects posted to the FIFO. Note: See the description of FIFOs in OSFifoInit for details on how to use this function. OS_FIFO *pfifo A pointer to an OS_FIFO structure. OS_FIFO_EL *ptopost A pointer to the user's structure cast as an OS_FIFO_EL to be posted to the Fifo. OS_NO_ERR (0) --- If successful OSFifoInit --- Initialize an os_fifo structure OSFifoPost --- Post to a fifo OSFifoPend --- Pend on a fifo OSFifoPendNoWait --- Pend on a fifo without waiting 35

36 2.28. OSFifoPend OS_FIFO_EL * OSFifoPend( OS_FIFO * pfifo, WORD timeout ); This function pends on a FIFO. Note: See the description of FIFOs in OSFifoInit for details on how to use this function. OS_FIFO *pfifo A pointer to an OS_FIFO structure. WORD timeout The number of ticks to wait on the Fifo. A pointer to the posted structure NULL --- If the function timed out OSFifoInit --- Initialize an os_fifo structure OSFifoPost --- Post to a fifo OSFifoPostFirst --- Post to the head of a fifo OSFifoPendNoWait --- Pend on a fifo without waiting 36

37 2.29. OSFifoPendNoWait OS_FIFO_EL * OSFifoPendNoWait( OS_FIFO * pfifo ); This function is identical to the OSFifoPen function, but it does not wait. Parameter: OS_FIFO *pfifo A pointer to an OS_FIFO structure. A pointer to the posted structure NULL --- If there was nothing in the fifo OSFifoInit --- Initialize an os_fifo structure OSFifoPost --- Post to a fifo OSFifoPostFirst --- Post to the head of a fifo OSFifoPend --- Pend on a fifo 37

38 2.30. OSCritInit BYTE OSCritInit( OS_CRIT * pcrit ); This function initializes the critical section. Important: You must call OSCritInit before using the critical section. Note: This function should be part of the initialization process. Parameter: OS_CRIT *pcrit A pointer to the critical section. OS_NO_ERR --- If successful OSCritEnter --- Tries to enters or claim the critical section OSCritEnterNoWait --- Tries to enter or claim the critical section without waiting OSCritLeave --- Releases the critical section 38

39 2.31. OSCritEnter BYTE OSCritEnter( OS_CRIT * pcrit, WORD timeout ); This function tries to enter or claim the critical section. Important: You must call OSCritLeave once for each successful OSCritEnter call to release the critical section so that another task can manipulate it. OS_Crit *pcrit A pointer to the critical section we want to enter/claim. WORD timeout How many time ticks do we want to wait for this critical section? Note: A timeout of 0 (zero) waits forever. OS_NO_ERR --- If we were successful in claiming the critical section or if our task owns it OS_TIMEOUT ---- If we were unable to claim the section OSCritInit --- Initializes the critical section OSCritEnterNoWait --- Tries to enter or claim the critical section without waiting OSCritLeave --- Releases the critical section 39

40 2.32. OSCritEnterNoWait BYTE OSCritEnterNoWait( OS_CRIT * pcrit ); This function tries to enter or claim the critical section. However, this function does not wait if it is unable to enter or claim the critical section. Important: You must call OSCritLeave once for each successful OSCritEnterNoWait call to release the critical section so another task can manipulate it. Parameter: OS_CRIT *pcrit A pointer to the critical section we want to enter/claim. OS_NO_ERR --- If we were successful in claiming the critical section, or if our task owns it OS_TIMEOUT --- If we were unable to claim the section OSCritInit --- Initializes the critical section OSCritEnter --- Tries to enters or claim the critical section OSCritLeave --- Releases the critical section 40

41 2.33. OSCritLeave BYTE OSCritLeave( OS_CRIT * pcrit ); This function releases the critical section. Important: This function must be called once for each successful OSCritEnter or OSCritEnterNoWait call to release the critical section so another task can manipulate it. Parameter: OS_CRIT *pcrit A pointer to the critical section we want to leave/release. OS_NO_ERR --- If we were successful in releasing the critical section OS_CRIT_ERR --- If we are trying to release a critical section that we do not own OSCritInit --- Initializes the critical section OSCritEnter --- Tries to enters or claim the critical section OSCritEnterNoWait --- Tries to enter or claim the critical section without waiting 41

42 2.34. Examples Example # 1 When I want to insert something at the beginning of a doubly linked list: typedef MyObject { MyObject * pnext; MyObject * pprev; * * * }; MyObject* phead; void InsertAtHead(MyObject * newobject) { /* Step 1 */ newobject->pnext=phead; /* Step 2 */ newobject->pprev=null; /* Step 3*/ phead->pprev=newobject; /* Step 4 */ phead=newobject; } Suppose another higher priority task interrupts us (between steps 3 and 4) and inserts its own element at the head of the list. The list would not be correct, because phead is reset to the object we are inserting in the task that was interrupted. To prevent this type of error from happening, you should use an OS_CRIT counted critical section. This will not lock or otherwise restrict the RTOS unless another task wants to claim the same critical section. The OS_CRIT object should be declared globally or as part of the structure/object you want to protect. Therefore, in the previous example, we would change the code to: MyObject* phead; OS_CRIT MyListCritical; void InsertAtHead(MyObject * newobject) { OSCritEnter(&MyListCritical,0); /* Step 1 */ newobject->pnext=phead; /* Step 2 */ newobject->pprev=null; /* Step 3*/ phead->pprev=newobject; /* Step 4 */ phead=newobject; OSCritLeave(&MyListCritical); } 42

43 Now, if a higher priority task tries to interrupt us between steps 3 and 4, the higher priority task will interrupt and call our InsertAtHeadFunction. But, as soon as it gets to the OSCritEnter call, it will be stopped. The higher priority task will discover that the MyListCritical object is already claimed/occupied by a lower priority task, so it will block and allow the lower priority tasks to run. This should allow our interrupted task to continue to the point where it leaves the critical section. When this happens, the critical section becomes available, and the higher priority task will run Example # 2 Suppose we have an instrument like a GPS (or a DVM) connected to one of our serial ports. This instrument answers questions. The questions may come from a logging task, a web page request, a Telnet session, etc. The problem arises when a low priority task (e.g. logging) asks "Where are we?" and before the GPS answers, the higher priority task (e.g. Telnet) asks "What time is it"? Example pseudo code: Logging task... /*1 */ Send(fdserial,"Where are we?"); /*2 */ WaitForResponsePacket(fdserial, buffer); /*3*/ SavePosition(buffer); Telnet task /*1 */ Send(fdserial,"What time is it?"); /*2 */ WaitForResponsePacket(fdserial, buffer); /*3*/ SendReply torequestor(buffer); The logging task does step 1, it sends "Where are we?" The telnet task interrupts, and sends "What time is it?" The GPS answers the first question - "Where are we? Because the Telnet task is a higher priority, it receives this ("Where are we?") response. Then the logging task wakes up and gets the next response - to the second question ("What time is it?"). Now we have logged the time to the where, and the where to the time request. Note: Adding an OSCritEnter function before step 1 in both tasks, and an OSCritLeave function after step 2 in each task will solve this problem. 43

44 2.35. OSIntEnter void OSIntEnter( void ); This function must be called in any user interrupt routine, before any RTOS functions are called. It must be followed by a call to OSIntExit. Important: OSIntEnter is taken care of in the INTERRUPT Macro for all NetBurner Platforms. Please read the Chapter on Interrupts in your NetBurner Runtime Libraries User s Manual for additional information. By default, this manual is found in C:\Nburn\docs. None Nothing --- This is a void function OSIntExit --- Must be called when a user interrupt is exited 44

45 2.36. OSIntExit void OSIntExit( void ); This function must be called when a user interrupt is exited. Important: OSIntExit is taken care of in the INTERRUPT Macro for all NetBurner Platforms. Please read the Chapter on Interrupts in your NetBurner Runtime Libraries User s Manual for additional information. By default, this manual is found in C:\Nburn\docs. None Nothing ---This is a void function OSIntExit --- Must be called when a user interrupt is exited 45

46 2.37. USER_ENTER_CRITICAL void USER_ENTER_CRITICAL( ); This function sets a level 7 interrupt mask when entered, allowing the user to have full processor time. This function will also disable all ucos functionality and block all hardware interrupts. Important: You must call USER_EXIT_CRITICAL once for each USER_ENTER_CRITICAL call to release the critical section. None Nothing --- This is a void function USER_EXIT_CRITICAL --- Sets the interrupt mask to the value before critical section was entered 46

47 2.38. USER_EXIT_CRITICAL void USER_EXIT_CRITICAL( ); This function sets the interrupt mask to the value before the critical section was entered. Important: You must call USER_EXIT_CRITICAL once for each USER_ENTER_CRITICAL call to release the critical section. None Nothing ---This is a void function USER_ENTER_CRITICAL --- Sets a level 7 interrupt mask when entered 47

48 2.39. OSDumpTCBStacks void OSDumpTCBStacks( void ); This function dumps information about the UCOS stacks and tasks to Stdout. This function is useful for debugging. Note: This function is only valid when UCOS_STACKCHECK is defined. None Nothing ---This is a void function Example: Prio Stack Ptr Stack Bottom Free Now Min. Free 63 0x20432d4 0x2042f x20451cc 0x x x20262cc x2020f2c 0x201efcc x2022f54 0x2020fde x2024f2c 0x OSDumpTasks --- Dump all of the task info to stdout 48

49 2.40. OSDumpTasks void OSDumpTasks( void ); This function dumps the state and call stack for every task to stdout. This function is useful for debugging. Note: This function is only valid when UCOS_STACKCHECK is defined. None Nothing --- This is a void function Example: Prio State Ticks Call Stack 63 Ready Forever At: Running >0200a7bc-><END> 40 Timer Fifo c98->020046ae-><END> 38 Fifo Forever 02007c98->02005d54-><END> 45 Semaphore Forever 02006f16-> > a-><END> OSDumpTCBStacks --- Dump all of the task stack information to stdout 49

50 2.41. ShowTaskList void ShowTaskList( void ); This function dumps the current RTOS task states to stdio. The output takes on multiple lines of the following format for each logged state: at t= [T] [Message] Followed by a tally of the number of task states logged since system start: Total messages: [N] [T] represents the number of ticks in hexadecimal since system start; [N] represents the number of task state messages in decimal logged since system start; [Message] represents one of the output messages listed in the below table. Message Wait for Semaphore Wake from Semaphore Task locked Task lock++ Task lock-- Task unlocked Task priority changed Unknown flag [F] Switched to Task [P] Switched to Task [P] PC=[X] Description Task is asleep and pending for semaphore Task gets a semaphore and wakes up Task becomes locked Task gets an added nested lock Task gets a nested lock unlocked Task becomes completely unlocked The task s priority level is changed The flag value defining the task s state is undefined Task priority [P] (in decimal) gets control Task priority [P] gets control with the program counter containing the address [X] (in hexadecimal) of the instruction being executed Note: Usage of this function is valid only when defining UCOS_TASKLIST in debug mode. In order to enable this macro definition, it must be uncommented in \Nburn\include\predef.h, followed by rebuilding the system files to incorporate the modification. Attempting to load a compiled non-debug application image with the macro defined will cause a trap error. Parameter: None None 50

51 2.42. OSFlagCreate void OSFlagCreate( OS_FLAGS *pf ) This function initializes an OS_FLAGS object that has already been declared. This function must be called before you can use an OS_FLAGS object. Parameter: OS_FLAGS *pf A pointer to the location of the object to be initialized. Nothing --- This is a void function. Example: OS_FLAGS test_flag; OSFlagCreate( &test_flag ); // Declare an OS_FLAGS object // Initialize the object 51

52 2.43. OSFlagSet void OSFlagSet( OS_FLAGS *flags, DWORD bits_to_set ) This function sets the corresponding bits asserted in bits_to_set of an OS_FLAGS object pointed to by *flags. OS_FLAGS *flags A pointer to the OS_FLAGS object to be configured. DWORD bits_to_set A bit or set of bits to be set. Nothing --- This is a void function. Example: OSFlagSet( &test_flag, 0x000000F0 ); // Set bits 4-7 of OS_FLAG // object "test_flag" 52

53 2.44. OSFlagState DWORD OSFlagState( OS_FLAGS *flags ) This function returns the current values of the flags stored in the OS_FLAGS object structure. Parameter: OS_FLAGS *flags A pointer to the OS_FLAGS object whose flag states are to be returned. The flag states of the OS_FLAGS object. Example: DWORD uint32_flags = OSFlagState( &test_flag ); if ( uint32_flags & 0x ) { iprintf( "Flag bit 7 is set.\r\n" ); } else { iprintf( "Flag bit 7 is clear.\r\n" ); } 53

54 2.45. OSFlagClear void OSFlagClear( OS_FLAGS *flags, DWORD bits_to_clr ) This function clears the bits asserted in bits_to_clr of an OS_FLAGS object pointed to by *flags. OS_FLAGS *flags A pointer to the OS_FLAGS object to be configured. DWORD bits_to_clr A bit or set of bits to be cleared. Nothing --- This is a void function. Example: OSFlagClear( &test_flag, 0x000000F0 ); // Clear bits 4-7 of OS_FLAG // object "test_flag" 54

55 2.46. OSFlagPendAll BYTE OSFlagPendAll( OS_FLAGS *flags, DWORD bit_mask, WORD timeout ) This function waits a number of time ticks specified by timeout until all the flags indicated by bit_mask are set. OS_FLAGS *flags A pointer to the OS_FLAGS object with the desired flag bits. DWORD bit_mask A bit or set of bets to wait on. WORD timeout Number of time ticks to wait on all specified flag bits to be set. OS_NO_ERR (0) --- All the flags indicated by bit_mask are set before timeout expires. OS_TIMEOUT (10) --- timeout expired. Example: if ( OSFlagPendAll ( &test_flag, 0x , 20 )!= OS_NO_ERR ) { iprintf( "Flag bits 15 and 31 were not set after 20 ticks.\r\n" ); } else { iprintf( "Both flag bits are set.\r\n" ); } 55

56 2.47. OSFlagPendAllNoWait BYTE OSFlagPendAllNoWait( OS_FLAGS *flags, DWORD bit_mask ) This function immediately checks to see if all the flag bits indicated by bit_mask are set; it does not wait. OS_FLAGS *flags A pointer to the OS_FLAGS object with the desired flag bits. DWORD bit_mask A bit or set of bits to check on. OS_NO_ERR (0) --- All flags indicated by bit_mask are set. OS_TIMEOUT (10) --- None or not all of the flags indicated by bit_mask are set. Example: if ( OSFlagPendAllNoWait( &test_flag, 0xFFFFFFFF )!= OS_NO_ERR ) { iprintf( "Not all of the flag bits are set.\r\n" ); } else { iprintf( "All 32 of the flag bits are set.\r\n" ); } 56

57 2.48. OSFlagPendAny BYTE OSFlagPendAny( OS_FLAGS *flags, DWORD bit_mask, WORD timeout ) This function waits a number of time ticks specified by timeout until any of the flags indicated by bit_mask are set. OS_FLAGS *flags A pointer to the OS_FLAGS object with the desired flag bits. DWORD bit_mask A bit or set of bits to wait on. WORD timeout Number of time ticks to wait on any specified flag bits to be set. OS_NO_ERR (0) --- At least one of the flag bits are set before timeout expires. OS_TIMEOUT (10) --- None of the flag bits are set before timeout expires. Example: if ( OSFlagPendAny( &test_flag, 0xFFFFFFFF, 20 )!= OS_NO_ERR ) { iprintf( "None of the flag bits are set before time expired.\r\n" ); } else { iprintf( "At least one of the 32 desired flag bits are set.\r\n" ); } 57

58 2.49. OSFlagPendAnyNoWait BYTE OSFlagPendAnyNoWait( OS_FLAGS *flags, DWORD bit_mask ) This function immediately checks to see if any of the flag bits indicated by bit_mask are set; it does not wait. OS_FLAGS *flags A pointer to the OS_FLAGS object with the desired flag bits. DWORD bit_mask A bit or set of bits to check on. OS_NO_ERR (0) --- At least one of the flags indicated by bit_mask are set. OS_TIMEOUT (10) --- None of the flags indicated by bit_mask are set. Example: if ( OSFlagPendAnyNoWait( &test_flag, 0x )!= OS_NO_ERR ) { iprintf( "Bits 1, 10, 16 and 31 are not set.\r\n" ); } else { iprintf( "At least one of the designated bits are set.\r\n" ); } 58

NetBurner s uc/os RTOS Library

NetBurner s uc/os RTOS Library NetBurner s uc/os RTOS Library Revision 1.1 July 17, 2007 Released 1 Table of Contents 1. Introduction... 4 2. Functions... 4 2.1. OSTaskCreate... 7 2.2. OSSimpleTaskCreate (MACRO)... 9 2.3. OSTaskDelete...

More information

EE458 - Embedded Systems Introduction to uc/os

EE458 - Embedded Systems Introduction to uc/os EE458 - Embedded Systems Introduction to uc/os Outline Introduction to uc/os References uc/os RTOS Library Reference 1 Background The source code to uc/os was published in Embedded Systems Programming

More information

Mod5234 Interrupt Controllers Application Note

Mod5234 Interrupt Controllers Application Note Mod5234 Interrupt Controllers Application Note Revision 1.0 June 22, 2007 Document Status: Second Release Table of Contents Introduction 3 General Procedure 3 Peripheral Module Configuration 4 Interrupt

More information

Micriμm. Getting Started with Micriμm s. Matt Gordon, Sr. Applications Engineer. 9L05I Renesas Electronics America Inc.

Micriμm. Getting Started with Micriμm s. Matt Gordon, Sr. Applications Engineer. 9L05I Renesas Electronics America Inc. Getting Started with Micriμm s μc/os-iii Kernel Matt Gordon, Sr. Applications Engineer Micriμm Class ID: 9L05I Renesas Electronics America Inc. 2012 Renesas Electronics America Inc. All rights reserved.

More information

Int tmytask() { while(1){ .. } }

Int tmytask() { while(1){ .. } } CHAPTER 2 BY RADU MURESAN Page 1 TASK OBJECT Upon creation, each task has an associated name, a unique ID, a priority (if part of a preemptive scheduling plan), a task control block (TCB), a stack, and

More information

Micrium µc/os II RTOS Introduction EE J. E. Lumpp

Micrium µc/os II RTOS Introduction EE J. E. Lumpp Micrium µc/os II RTOS Introduction (by Jean Labrosse) EE599 001 Fall 2012 J. E. Lumpp μc/os II μc/os II is a highly portable, ROMable, very scalable, preemptive real time, deterministic, multitasking kernel

More information

Embedded Systems: OS. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Embedded Systems: OS. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Embedded Systems: OS Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Standalone Applications Often no OS involved One large loop Microcontroller-based

More information

Embedded Systems: OS

Embedded Systems: OS Embedded Systems: OS Jinkyu Jeong (Jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu ICE3028: Embedded Systems Design, Fall 2018, Jinkyu Jeong (jinkyu@skku.edu) Standalone

More information

Micrium OS Kernel Labs

Micrium OS Kernel Labs Micrium OS Kernel Labs 2018.04.16 Micrium OS is a flexible, highly configurable collection of software components that provides a powerful embedded software framework for developers to build their application

More information

Embedded Software TI2726 B. 7. Embedded software design. Koen Langendoen. Embedded Software Group

Embedded Software TI2726 B. 7. Embedded software design. Koen Langendoen. Embedded Software Group Embedded Software 7. Embedded software design TI2726 B Koen Langendoen Embedded Software Group Overview Timing services RTOS and ISRs Design of embedded systems General principles Timing Functionality

More information

10. I/O System Library

10. I/O System Library 10. I/O System Library Header File #include // Found in C:\Nburn\include General File Descriptor Functions close --- Close open file descriptors read --- Read data from a file descriptor ReadWithTimeout

More information

Lab 8 Real-time OS - 1

Lab 8 Real-time OS - 1 Lab 8-1 Speaker: Hao-Yun Chin Advisor: Prof. Tian-Sheuan Chang Apr 27, 2004 Outline Introduction to Real-time Operation System (RTOS) Introduction to C/OS-II Features Task & task scheduling Start C/OS-II

More information

Mod5282 Programmable Interrupt Timer Application Note

Mod5282 Programmable Interrupt Timer Application Note Mod5282 Programmable Interrupt Timer Application Note Revision 2.1 November 16, 2011 Table of Contents Introduction 3 PIT Registers 3 PIT Control and Status Register (PCSR) 3 PIT Modulus Register (PMR)

More information

Nios II. uc/os-ii porting with Nios II Altera Corporation

Nios II. uc/os-ii porting with Nios II Altera Corporation Nios II uc/os-ii porting with Nios II 2002 2 µc/os-ii Main Features Portable (Most 8, 16, 32 and 64 bit CPUs) ROMable Scalable Preemptive Real-Time Deterministic High Performance Multitasking Robust Provides

More information

Measurement laboratory 3 Embedded operating systems

Measurement laboratory 3 Embedded operating systems Budapest University of Technology and Economics Department of Measurement and Information Systems Measurement laboratory 3 Embedded operating systems Student s guide Version: 1.4 2013 / July / 15 NASZÁLY

More information

ENGG4420 CHAPTER 2 HOMEWORK

ENGG4420 CHAPTER 2 HOMEWORK CHAPTER 2 By Radu Muresan University of Guelph Page 1 TYPICAL MESSAGE QUEUE USE The following are typical ways to use message queues within an application: 1) non interlocked, one way data communication;

More information

Micriµm, Inc. Copyright 2001, Micriµm, Inc. All Rights reserved. and Event Flags. Application Note AN-1007A

Micriµm, Inc. Copyright 2001, Micriµm, Inc. All Rights reserved. and Event Flags. Application Note AN-1007A Micriµm, Inc Copyright 2001, Micriµm, Inc All Rights reserved µc/os-ii and Event Flags Application Note AN-1007A Jean J Labrosse JeanLabrosse@Micriumcom wwwmicriumcom Summary Event flags are used when

More information

ArdOS The Arduino Operating System Reference Guide Contents

ArdOS The Arduino Operating System Reference Guide Contents ArdOS The Arduino Operating System Reference Guide Contents 1. Introduction... 2 2. Error Handling... 2 3. Initialization and Startup... 2 3.1 Initializing and Starting ArdOS... 2 4. Task Creation... 3

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. CMSIS Version 3.0 RTOS API

CODE TIME TECHNOLOGIES. Abassi RTOS. CMSIS Version 3.0 RTOS API CODE TIME TECHNOLOGIES Abassi RTOS CMSIS Version 3.0 RTOS API Copyright Information This document is copyright Code Time Technologies Inc. 2011-2013. All rights reserved. No part of this document may be

More information

SpiNNaker Application Programming Interface (API)

SpiNNaker Application Programming Interface (API) SpiNNaker Application Programming Interface (API) Version 2.0.0 10 March 2016 Application programming interface (API) Event-driven programming model The SpiNNaker API programming model is a simple, event-driven

More information

Real-Time Programming

Real-Time Programming Real-Time Programming Week 7: Real-Time Operating Systems Instructors Tony Montiel & Ken Arnold rtp@hte.com 4/1/2003 Co Montiel 1 Objectives o Introduction to RTOS o Event Driven Systems o Synchronization

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ATmega128 GCC

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ATmega128 GCC CODE TIME TECHNOLOGIES Abassi RTOS Porting Document ATmega128 GCC Copyright Information This document is copyright Code Time Technologies Inc. 2011,2012. All rights reserved. No part of this document may

More information

real-time kernel documentation

real-time kernel documentation version 1.1 real-time kernel documentation Introduction This document explains the inner workings of the Helium real-time kernel. It is not meant to be a user s guide. Instead, this document explains overall

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ARM Cortex-M3 CCS

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ARM Cortex-M3 CCS CODE TIME TECHNOLOGIES Abassi RTOS Porting Document ARM Cortex-M3 CCS Copyright Information This document is copyright Code Time Technologies Inc. 2011,2012. All rights reserved. No part of this document

More information

INTERRUPT MANAGEMENT An interrupt is a hardware mechanism used to service an event that can be external or internal to

INTERRUPT MANAGEMENT An interrupt is a hardware mechanism used to service an event that can be external or internal to CHAPTER 2 ucosiii Page 1 ENGG4420 CHAPTER 2 LECTURE 5 October 22 12 3:28 PM INTERRUPT MANAGEMENT An interrupt is a hardware mechanism used to service an event that can be external or internal to the CPU.

More information

embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.0 Revision: 0 Date: September 18, 2017

embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.0 Revision: 0 Date: September 18, 2017 embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.0 Revision: 0 Date: September 18, 2017 A product of SEGGER Microcontroller GmbH & Co. KG www.segger.com

More information

µc/os-ii for the Philips XA

µc/os-ii for the Philips XA Application Note AN-1000 Jean J. Labrosse Jean.Labrosse@uCOS-II.com www.ucos-ii.com Acknowledgements I would like to thank Tasking Software for providing me with their fine compiler (V3.0r0) and CrossView

More information

Programming in Real-Time OS (uc/os-ii)

Programming in Real-Time OS (uc/os-ii) Programming in Real-Time OS (uc/os-ii) 경희대학교컴퓨터공학과 조진성 Embedded Software Taxonomy [2] Library only Non-multitasking AVR studio Real-time OS (Embedded OS) Preemptive multitasking Micro-kernel approach VxWorks

More information

The CMXBug Manual. The CMXBug Manual

The CMXBug Manual. The CMXBug Manual The CMX CMXBug TM debugger provides the ability to view and modify different aspects of the CMX multitasking operating system environment, while application code is running. CMXBug runs as a task, usually

More information

embos Real-Time Operating System CPU & Compiler specifics for embos Visual Studio Simulation

embos Real-Time Operating System CPU & Compiler specifics for embos Visual Studio Simulation embos Real-Time Operating System CPU & Compiler specifics for Document: UM01060 Software Version: 5.02 Revision: 0 Date: July 25, 2018 A product of SEGGER Microcontroller GmbH www.segger.com 2 Disclaimer

More information

embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.1 Revision: 0 Date: May 3, 2018

embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.1 Revision: 0 Date: May 3, 2018 embos Real-Time Operating System Document: UM01025 Software Version: 3.1 Revision: 0 Date: May 3, 2018 A product of SEGGER Microcontroller GmbH www.segger.com 2 Disclaimer Specifications written in this

More information

V (http://www.tnkernel.com/) Copyright 2004 Yuri Tiomkin

V (http://www.tnkernel.com/) Copyright 2004 Yuri Tiomkin Real-Time Kernel V 10 (http://wwwtnkernelcom/) Copyright 2004 Yuri Tiomkin Document Disclaimer The information in this document is subject to change without notice While the information herein is assumed

More information

6 System Processes Keyboard Command Decoder CRT Display... 26

6 System Processes Keyboard Command Decoder CRT Display... 26 Contents 1 INTRODUCTION 5 2 GLOBAL INFORMATION 6 2.1 Process States................................... 6 2.2 Message Types.................................. 6 2.3 Kernel Control Structure.............................

More information

GLOSSARY. VisualDSP++ Kernel (VDK) User s Guide B-1

GLOSSARY. VisualDSP++ Kernel (VDK) User s Guide B-1 B GLOSSARY Application Programming Interface (API) A library of C/C++ functions and assembly macros that define VDK services. These services are essential for kernel-based application programs. The services

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Embedded Software TI2726-B January 29, 2018 13.30-15.00 This exam (6 pages) consists of 60 True/False

More information

Chapter 11 Message Queue Management. System & Network Lab Tsung-Yu Ye

Chapter 11 Message Queue Management. System & Network Lab Tsung-Yu Ye Chapter 11 Message Queue Management System & Network Lab Tsung-Yu Ye Outline Introduction Creating a Message Queue, OSQCreate() Deleting a Message Queue, OSQDel() Waiting for a message at a Queue, OSQPend()

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Embedded Software TI2726-B January 28, 2019 13.30-15.00 This exam (6 pages) consists of 60 True/False

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document AVR32A GCC

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document AVR32A GCC CODE TIME TECHNOLOGIES Abassi RTOS Porting Document AVR32A GCC Copyright Information This document is copyright Code Time Technologies Inc. 2011-2013. All rights reserved. No part of this document may

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

A New Real-time Kernel development on an embedded platform

A New Real-time Kernel development on an embedded platform A New Real-time Kernel development on an embedded platform CSC714: Real Time Systems Project Final Report Spring 2009 BALASUBRAMANYA BHAT (bbhat@ncsu.edu) SANDEEP BUDANUR RAMANNA (sbudanu@ncsu.edu) - 1

More information

Threads Tuesday, September 28, :37 AM

Threads Tuesday, September 28, :37 AM Threads_and_fabrics Page 1 Threads Tuesday, September 28, 2004 10:37 AM Threads A process includes an execution context containing Memory map PC and register values. Switching between memory maps can take

More information

The CMXTracker Manual. The CMXTracker Manual

The CMXTracker Manual. The CMXTracker Manual The CMXTracker Manual The CMX CMXTracker TM Code Analyzer provides the ability to log chronologically in real-time, the tasks' execution flow, capturing when a task is executing, the CMX functions called

More information

AN HONORS UNIVERSITY IN MARYLAND UMBC. AvrX. Yousef Ebrahimi Professor Ryan Robucci

AN HONORS UNIVERSITY IN MARYLAND UMBC. AvrX.   Yousef Ebrahimi Professor Ryan Robucci AvrX https://github.com/kororos/avrx Yousef Ebrahimi Professor Ryan Robucci Introduction AvrX is a Real Time Multitasking Kernel written for the Atmel AVR series of micro controllers. The Kernel is written

More information

Exam TI2720-C/TI2725-C Embedded Software

Exam TI2720-C/TI2725-C Embedded Software Exam TI2720-C/TI2725-C Embedded Software Wednesday April 16 2014 (18.30-21.30) Koen Langendoen In order to avoid misunderstanding on the syntactical correctness of code fragments in this examination, we

More information

EE458 - Embedded Systems Lecture 8 Semaphores

EE458 - Embedded Systems Lecture 8 Semaphores EE458 - Embedded Systems Lecture 8 Semaphores Outline Introduction to Semaphores Binary and Counting Semaphores Mutexes Typical Applications RTEMS Semaphores References RTC: Chapter 6 CUG: Chapter 9 1

More information

805xRTOS. Generated by Doxygen 1.6.3

805xRTOS. Generated by Doxygen 1.6.3 805xRTOS Generated by Doxygen 1.6.3 Fri Jun 11 17:48:33 2010 Contents 1 RTOS 1 2 Module Index 3 2.1 Modules................................. 3 3 Data Structure Index 5 3.1 Data Structures.............................

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ATmega128 IAR

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ATmega128 IAR CODE TIME TECHNOLOGIES Abassi RTOS Porting Document ATmega128 IAR Copyright Information This document is copyright Code Time Technologies Inc. 2011,2012. All rights reserved. No part of this document may

More information

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT C Review MaxMSP Developers Workshop Summer 2009 CNMAT C Syntax Program control (loops, branches): Function calls Math: +, -, *, /, ++, -- Variables, types, structures, assignment Pointers and memory (***

More information

To obtain the current global trace mask, call meitraceget(...). To modify the global trace mask, call meitraceset(...).

To obtain the current global trace mask, call meitraceget(...). To modify the global trace mask, call meitraceset(...). Trace Objects Trace Objects Introduction Use the Trace module to selectively produce trace output on a global and/or per-object basis for your application. You can specify the types of trace output when

More information

ENGG4420 CHAPTER 2 LECTURE 6

ENGG4420 CHAPTER 2 LECTURE 6 CHAPTER 2 ucosiii Page 1 ENGG4420 CHAPTER 2 LECTURE 6 October 25 12 5:03 PM SEMAPHORE INTERNALS OS_SEM data type defined in os.h Semaphore services are enabled at compile time by setting the configuration

More information

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34 A Brief Overview Christopher Kenna Avionics October 1, 2010 1 / 34 Introduction Outline 1 Introduction About Kernel Overview 2 Tasks Tasks versus Co-Routines Task Details 3 IPC and Synchronization Queues

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document C28X CCS

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document C28X CCS CODE TIME TECHNOLOGIES Abassi RTOS Porting Document C28X CCS Copyright Information This document is copyright Code Time Technologies Inc. 2012-2013. All rights reserved. No part of this document may be

More information

ME 4447/ME Microprocessor Control of Manufacturing Systems/ Introduction to Mechatronics. Instructor: Professor Charles Ume

ME 4447/ME Microprocessor Control of Manufacturing Systems/ Introduction to Mechatronics. Instructor: Professor Charles Ume ME 4447/ME 6405 Microprocessor Control of Manufacturing Systems/ Introduction to Mechatronics Instructor: Professor Charles Ume Lecture on Codewarrior Integrated Development Environment Contents Overview

More information

Micriµm, Inc. µc/os-view

Micriµm, Inc. µc/os-view Micriµm, Inc. Copyright 2002-2003, Micriµm, Inc. All Rights reserved V.0 User s Manual Rev. C www.micrium.com Table of Contents.00 Introduction....0 Revision History... 6.0.0 V.0... 6 2.00 Windows Application...

More information

Messaging Framework Module Guide

Messaging Framework Module Guide Application Note Renesas Synergy Platform R11AN0096EU0102 Rev.1.02 Introduction This module guide will enable you to effectively use a module in your own design. Upon completion of this guide, you will

More information

V. 2. (http://www.tnkernel.com/) Copyright 2004, 2006 Yuri Tiomkin

V. 2. (http://www.tnkernel.com/) Copyright 2004, 2006 Yuri Tiomkin TNKernel Real-Time Kernel V. 2 (http://www.tnkernel.com/) Copyright 2004, 2006 Yuri Tiomkin Document Disclaimer The information in this document is subject to change without notice. While the information

More information

Appendix A Pseudocode of the wlan_mac Process Model in OPNET

Appendix A Pseudocode of the wlan_mac Process Model in OPNET Appendix A Pseudocode of the wlan_mac Process Model in OPNET static void wlan_frame_transmit () { char msg_string [120]; char msg_string1 [120]; WlanT_Hld_List_Elem* hld_ptr; const WlanT_Data_Header_Fields*

More information

Intertask Communication

Intertask Communication Inter-task Communication 04/27/01 Lecture # 29 16.070 Task state diagram (single processor) Intertask Communication Global variables Buffering data Critical regions Synchronization Semaphores Mailboxes

More information

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski Operating Systems Design Fall 2010 Exam 1 Review Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 To a programmer, a system call looks just like a function call. Explain the difference in the underlying

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. 8051/8052 Keil Compiler

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. 8051/8052 Keil Compiler CODE TIME TECHNOLOGIES Abassi RTOS Porting Document 8051/8052 Keil Compiler Copyright Information This document is copyright Code Time Technologies Inc. 2011. All rights reserved. No part of this document

More information

embos Real Time Operating System CPU & Compiler specifics for ARM core with ARM RealView Developer Suite 3.0 Document Rev. 1

embos Real Time Operating System CPU & Compiler specifics for ARM core with ARM RealView Developer Suite 3.0 Document Rev. 1 embos Real Time Operating System CPU & Compiler specifics for ARM core with ARM RealView Developer Suite 3.0 Document Rev. 1 A product of SEGGER Microcontroller GmbH & Co. KG www.segger.com 2/25 embos

More information

CSE306 - Homework2 and Solutions

CSE306 - Homework2 and Solutions CSE306 - Homework2 and Solutions Note: your solutions must contain enough information to enable the instructor to judge whether you understand the material or not. Simple yes/no answers do not count. A

More information

Embedded Systems. 5. Operating Systems. Lothar Thiele. Computer Engineering and Networks Laboratory

Embedded Systems. 5. Operating Systems. Lothar Thiele. Computer Engineering and Networks Laboratory Embedded Systems 5. Operating Systems Lothar Thiele Computer Engineering and Networks Laboratory Embedded Operating Systems 5 2 Embedded Operating System (OS) Why an operating system (OS) at all? Same

More information

CSci 4061 Introduction to Operating Systems. Programs in C/Unix

CSci 4061 Introduction to Operating Systems. Programs in C/Unix CSci 4061 Introduction to Operating Systems Programs in C/Unix Today Basic C programming Follow on to recitation Structure of a C program A C program consists of a collection of C functions, structs, arrays,

More information

Dealing with Issues for Interprocess Communication

Dealing with Issues for Interprocess Communication Dealing with Issues for Interprocess Communication Ref Section 2.3 Tanenbaum 7.1 Overview Processes frequently need to communicate with other processes. In a shell pipe the o/p of one process is passed

More information

NOTE: Debug and DebugSingle are the only MPI library configurations that will produce trace output.

NOTE: Debug and DebugSingle are the only MPI library configurations that will produce trace output. Trace Objects Trace Objects Introduction Use the Trace module to selectively produce trace output on a global and/or per-object basis for your application. You can specify the types of trace output when

More information

20-EECE-4029 Operating Systems Fall, 2015 John Franco

20-EECE-4029 Operating Systems Fall, 2015 John Franco 20-EECE-4029 Operating Systems Fall, 2015 John Franco First Exam Question 1: Barrier name: a) Describe, in general terms, what a barrier is trying to do Undo some of the optimizations that processor hardware

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document MSP430 GCC

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document MSP430 GCC CODE TIME TECHNOLOGIES Abassi RTOS Porting Document MSP430 GCC Copyright Information This document is copyright Code Time Technologies Inc. 2011,2012. All rights reserved. No part of this document may

More information

SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T A N D S P R I N G 2018

SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T A N D S P R I N G 2018 SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T 2. 3. 8 A N D 2. 3. 1 0 S P R I N G 2018 INTER-PROCESS COMMUNICATION 1. How a process pass information to another process

More information

Migrate RTX to CMSIS-RTOS

Migrate RTX to CMSIS-RTOS Migrate to CMSIS-RTOS AN264, May 2014, V 1.0 Abstract This application note demonstrates how to migrate your existing based application to the new CMSIS-RTOS layer. Introduction The CMSIS-RTOS API is a

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ATmega IAR

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ATmega IAR CODE TIME TECHNOLOGIES Abassi RTOS Porting Document ATmega IAR Copyright Information This document is copyright Code Time Technologies Inc. 2011-2013. All rights reserved. No part of this document may

More information

Pebbles Kernel Specification September 26, 2004

Pebbles Kernel Specification September 26, 2004 15-410, Operating System Design & Implementation Pebbles Kernel Specification September 26, 2004 Contents 1 Introduction 2 1.1 Overview...................................... 2 2 User Execution Environment

More information

Any of the descriptors in the set {1, 4} have an exception condition pending

Any of the descriptors in the set {1, 4} have an exception condition pending Page 1 of 6 6.3 select Function This function allows the process to instruct the kernel to wait for any one of multiple events to occur and to wake up the process only when one or more of these events

More information

INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS

INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS Pages 792 to 800 Anna Rakitianskaia, University of Pretoria INITIALISING POINTER VARIABLES Pointer variables are declared by putting

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ARM Cortex-A9 CCS

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ARM Cortex-A9 CCS CODE TIME TECHNOLOGIES Abassi RTOS Porting Document ARM Cortex-A9 CCS Copyright Information This document is copyright Code Time Technologies Inc. 2012. All rights reserved. No part of this document may

More information

CODE TIME TECHNOLOGIES. µabassi RTOS. User s Guide

CODE TIME TECHNOLOGIES. µabassi RTOS. User s Guide CODE TIME TECHNOLOGIES µabassi RTOS User s Guide Copyright Information This document is copyright Code Time Technologies Inc. 2013-2018. All rights reserved. No part of this document may be reproduced

More information

PROCESS STATES AND TRANSITIONS:

PROCESS STATES AND TRANSITIONS: The kernel contains a process table with an entry that describes the state of every active process in the system. The u area contains additional information that controls the operation of a process. The

More information

A Fast Review of C Essentials Part I

A Fast Review of C Essentials Part I A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types

More information

8032 MCU + Soft Modules. c = rcvdata; // get the keyboard scan code

8032 MCU + Soft Modules. c = rcvdata; // get the keyboard scan code 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 { 0x25, 0x66 }, // "4" { 0x2E, 0x6D }, // "5" { 0x36, 0x7D }, // "6" { 0x3D, 0x07 }, // "7" { 0x3E, 0x7F }, // "8" { 0x46,

More information

Programming in C - Part 2

Programming in C - Part 2 Programming in C - Part 2 CPSC 457 Mohammad Reza Zakerinasab May 11, 2016 These slides are forked from slides created by Mike Clark Where to find these slides and related source code? http://goo.gl/k1qixb

More information

Processes COMPSCI 386

Processes COMPSCI 386 Processes COMPSCI 386 Elements of a Process A process is a program in execution. Distinct processes may be created from the same program, but they are separate execution sequences. call stack heap STACK

More information

ADVANCED OPERATING SYSTEMS

ADVANCED OPERATING SYSTEMS ADVANCED OPERATING SYSTEMS UNIT 2 FILE AND DIRECTORY I/O BY MR.PRASAD SAWANT Prof.Prasad Sawant,Assitiant Professor,Dept. Of CS PCCCS Chichwad Prof.Prasad Sawant,Assitiant Professor,Dept. Of CS PCCCS Chichwad

More information

Memory management, part 2: outline. Operating Systems, 2017, Danny Hendler and Amnon Meisels

Memory management, part 2: outline. Operating Systems, 2017, Danny Hendler and Amnon Meisels Memory management, part 2: outline 1 Page Replacement Algorithms Page fault forces choice o which page must be removed to make room for incoming page? Modified page must first be saved o unmodified just

More information

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ARM Cortex-M0 Atollic

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ARM Cortex-M0 Atollic CODE TIME TECHNOLOGIES Abassi RTOS Porting Document ARM Cortex-M0 Atollic Copyright Information This document is copyright Code Time Technologies Inc. 2012. All rights reserved. No part of this document

More information

Real Time Operating System: Inter-Process Communication (IPC)

Real Time Operating System: Inter-Process Communication (IPC) ECE3411 Fall 2015 Lecture 6c. Real Time Operating System: Inter-Process Communication (IPC) Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut

More information

This resource describes how to program the myrio in C to perform timer interrupts.

This resource describes how to program the myrio in C to perform timer interrupts. Resource 07 Timer interrupts This resource describes how to program the myrio in C to perform timer interrupts. C.07.1 Main thread: background Initializing the timer interrupt is similar to initializing

More information

Hands-on Workshop: Freescale MQX and Tower System RTOS Getting Started (Part 2)

Hands-on Workshop: Freescale MQX and Tower System RTOS Getting Started (Part 2) August, 2010 Hands-on Workshop: Freescale MQX and Tower System RTOS Getting Started (Part 2) ENT-F0720 Shen Li and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names

More information

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34

FreeRTOS. A Brief Overview. Christopher Kenna. October 1, Avionics. FreeRTOS 1 / 34 FreeRTOS A Brief Overview Christopher Kenna Avionics October 1, 2010 FreeRTOS 1 / 34 Background Information The FreeRTOS Project supports 25 official architecture ports, with many more community developed

More information

Platform Objects. Introduction. Methods. meiplatformalloc meiplatformassertset

Platform Objects. Introduction. Methods. meiplatformalloc meiplatformassertset Platform Objects Platform Objects Introduction The Platform module provides a common interface to platform-specific functionality, such as memory allocation, resource locking, interrupts, signalling, and

More information

Processes. Johan Montelius KTH

Processes. Johan Montelius KTH Processes Johan Montelius KTH 2017 1 / 47 A process What is a process?... a computation a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other

More information

Process Coordination and Shared Data

Process Coordination and Shared Data Process Coordination and Shared Data Lecture 19 In These Notes... Sharing data safely When multiple threads/processes interact in a system, new species of bugs arise 1. Compiler tries to save time by not

More information

OPERATING SYSTEM PROJECT: SOS

OPERATING SYSTEM PROJECT: SOS OPERATING SYSTEM PROJECT: SOS I. Description 1. This project simulates a noninteractive (batch) monolithic operating system. Your program, OS, is a set of functions invoked by SOS (Student Operating System),

More information

Interrupt/Timer/DMA 1

Interrupt/Timer/DMA 1 Interrupt/Timer/DMA 1 Exception An exception is any condition that needs to halt normal execution of the instructions Examples - Reset - HWI - SWI 2 Interrupt Hardware interrupt Software interrupt Trap

More information

Virtual Machine Design

Virtual Machine Design Virtual Machine Design Lecture 4: Multithreading and Synchronization Antero Taivalsaari September 2003 Session #2026: J2MEPlatform, Connected Limited Device Configuration (CLDC) Lecture Goals Give an overview

More information

COMP 524 Spring 2018 Midterm Thursday, March 1

COMP 524 Spring 2018 Midterm Thursday, March 1 Name PID COMP 524 Spring 2018 Midterm Thursday, March 1 This exam is open note, open book and open computer. It is not open people. You are to submit this exam through gradescope. Resubmissions have been

More information

Introduction to the ThreadX Debugger Plugin for the IAR Embedded Workbench C-SPYDebugger

Introduction to the ThreadX Debugger Plugin for the IAR Embedded Workbench C-SPYDebugger C-SPY plugin Introduction to the ThreadX Debugger Plugin for the IAR Embedded Workbench C-SPYDebugger This document describes the IAR C-SPY Debugger plugin for the ThreadX RTOS. The ThreadX RTOS awareness

More information

A process. the stack

A process. the stack A process Processes Johan Montelius What is a process?... a computation KTH 2017 a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other processes

More information

1 Introduction. 2 Managing contexts. Green, green threads of home. Johan Montelius HT2018

1 Introduction. 2 Managing contexts. Green, green threads of home. Johan Montelius HT2018 1 Introduction Green, green threads of home Johan Montelius HT2018 This is an assignment where you will implement your own thread library. Instead of using the operating systems threads you will create

More information

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead. Chapter 9: Rules Chapter 1:Style and Program Organization Rule 1-1: Organize programs for readability, just as you would expect an author to organize a book. Rule 1-2: Divide each module up into a public

More information