tailieunhanh - Real-Time Embedded Multithreading Using ThreadX and MIPS- P7
Real-Time Embedded Multithreading Using ThreadX and MIPS- P7:Although the history of embedded systems is relatively short, 1 the advances and successes of this fi eld have been profound. Embedded systems are found in a vast array of applications such as consumer electronics, “ smart ” devices, communication equipment, automobiles, desktop computers, and medical equipment. | Mutual Exclusion Challenges and Considerations 119 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 Application Definitions Define what the initial system looks like. void tx_application_define void first_unused_memory Put system definitions here . thread and mutex creates Create the Speedy_Thread. tx_thread_create Speedy_Thread Speedy_Thread Speedy_Thread_entry 0 stack_speedy STACK_SIZE 5 5 TX_NO_TIME_SLICE TX_AUTO_START Create the Slow_Thread tx_thread_create Slow_Thread Slow_Thread Slow_Thread_entry 1 stack_slow STACK_SIZE 15 15 TX_NO_TIME_SLICE TX_AUTO_START Create the mutex used by both threads tx_mutex_create my_mutex my_mutex TX_NO_INHERIT Function Definitions Define the activities for the Speedy_Thread void Speedy_Thread_entry ULONG thread_input iESlJ tf 3 vs J . JZ . Please purchase PDF Split-Merge on 120 Chapter 8 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 UINT status ULONG current_time while 1 Activity 1 2 timer-ticks. tx_thread_sleep 2 Activity 2 5 timer-ticks critical section Get the mutex with suspension. status tx_mutex_get my_mutex TX_WAIT_FOREVER if status TX_SUCCESS break Check status tx_thread_sleep 5 Release the mutex. status tx_mutex_put my_mutex if status TX_SUCCESS break Check status Activity 3 4 timer-ticks. tx_thread_sleep 4 Activity 4 3 timer-ticks critical section Get the mutex with suspension. status tx_mutex_get my_mutex TX_WAIT_FOREVER if status TX_SUCCESS break Check status tx_thread_sleep 3 Release the mutex. status tx_mutex_put my_mutex if status TX_SUCCESS break Check status current_time tx_time_get printf Current Time lu Speedy_Thread finished cycle. n Ple on to remove this watermark. Mutual Exclusion Challenges and Considerations 121 125 126 127 .
đang nạp các trang xem trước