| datta016 (22) | |
|
Hi all, I'm generally not a poster, however, I am being introduced to C++ Embedded Systems Programming (a field I am admittedly relatively ignorant to--the embedded programming part, not the C++ =P). I have been given a sample problem and I am a little confused on how to go about starting/solving it. The following is the objective: To make an application that will utilize the following: Message Queues, Semaphores, Timers, Priority Levels, Task Delays, data synchronization (by using message queue) Your class will contain the following: Task 1: * Highest priority task * Pends on Timer event (which should be set to occur every 1 second) * Sends message to Task 3 * releases Task 3's semaphore after sending messages Task 2: * Middle priority task * pends on semaphore * receives message queue and prints out the spare cycles. * utilizes task delay after getting message queue information (10 msecs) * clears cycle count being incremented in Task 4 Task 3: * Lower priority task then Task 2 * Sends Message to task 2 (Should see that Task 2 will then run taking time from task 3) * Message sent to task 2 will contain cycle count being calculated in Task 4 Task 4: * Lowest priority task * Counts Spare Cycle Time (only the lowest priority task in the system can do this. All in all I am a bit confused as to what a semaphore is, through Wikipedia I was able to come up with the general definition of it being a protected variable... in addition to this I am a bit lost in how to incorporate timers and cycles in C++, something I have never handled before. ANY help that can be provided would be absolutely appreciated. Also, in advance, I apologize if I am asking for too much. I just need some guidance with this, as mentioned above, this is a bit new to me. Thank you all for your time. | |
|
|
|
| vcsasc (3) | |
|
Hi, I am also interested in similar interest in Windows OS.I am also a beginner. If you OS is Microsoft Windows related, You can refer the following books. 1) Windows Internals -4th Edtion- David Solomon and Mark Russinovich. 2) Windows System Programming - Johnson M Hart Meanwhile,I try some ideas for task 1( at least) .Can you post,some more detail ? | |
|
|
|
| datta016 (22) | |
|
WELL!!! It's been a couple weeks =P BUT, I was able to figure it all out. It honestly wasn't that difficult. The OS (or RTOS rather) I was using is known as vxWorks. There is some outstanding documentation that comes along with it--and I recommend all who would like to venture into RTOS programming to check them out. I was able to solve the problem with the following as references (mind you, prior to these references I didn't even know what an RTOS was): BOOKS: VxWorks Kernel API Reference Vol 2, 6.3 VxWorks Kernel Programmers Guide, 6.3 ONLINE: Intro to Reentrancy - http://www.embedded.com/story/OEG20010311S0005 Round-Robin Scheduling - http://en.wikipedia.org/wiki/Round-robin_scheduling Interrupts - http://en.wikipedia.org/wiki/Interrupt EDF (Least Time To Go) - http://en.wikipedia.org/wiki/Earliest_deadline_first_scheduling Dynamic Memory Allocation - http://en.wikipedia.org/wiki/Memory_allocation Fixed Priority Pre-Emptive Scheduling - http://en.wikipedia.org/wiki/Fixed_priority_pre-emptive_scheduling RTOS - http://en.wikipedia.org/wiki/RTOS Effective Use of RTOS Programming for Multithreaded Arc - http://www.embedded.com/columns/showArticle.jhtml?articleID=192501328 Mutex: Dekker - http://en.wikipedia.org/wiki/Dekker%27s_algorithm#Pseudocode Peterson - http://en.wikipedia.org/wiki/Peterson%27s_algorithm Lamport - http://en.wikipedia.org/wiki/Lamport%27s_bakery_algorithm Critical Section – http://en.wikipedia.org/wiki/Critical_section INCREDIBLE HELP -> http://www.cs.ru.nl/lab/vxworks/www.rt.db.erau.edu/toc/TableOfContents.html | |
|
|
|
| datta016 (22) | |||
And here is the code... I do recommend to try this on your own though... copying mine will do nothing for you. Enjoy!
| |||
|
|
|||