TAILIEUCHUNG - Real-Time Embedded Multithreading Using ThreadX and MIPS- P11

Real-Time Embedded Multithreading Using ThreadX and MIPS- P11: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. | 202 Chapter 11 081 082 083 084 085 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 stack_slow STACK_SIZE 15 15 TX_NO_TIME_SLICE TX_AUTO_START Create the counting semaphore used by both threads tx_semaphore_create my_semaphore my_semaphore 0 Create and activate the timer tx_timer_create stats_timer stats_timer print_stats 0x1234 500 500 TX_AUTO_ACTIVATE Function Definitions Define the activities for the Producer speedy thread void Speedy_Thread_entry ULONG thread_input UINT status ULONG start_time cycle_time current_time while 1 Get the starting time for this cycle start_time tx_time_get Activity 1 2 timer-ticks. tx_thread_sleep 2 Put an instance in the counting semaphore. status tx_semaphore_put my_semaphore if status TX_SUCCESS break Check status Activity 2 5 timer-ticks. tx_thread_sleep 5 Ple on to remove this watermark. Event Notification and Synchronization with Counting Semaphores 203 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 Activity 3 4 timer-ticks. tx_thread_sleep 4 Put an instance in the counting semaphore. status tx_semaphore_put my_semaphore if status TX_SUCCESS break Check status Activity 4 3 timer-ticks. tx_thread_sleep 3 Increment the thread counter and get timing info Speedy_Thread_counter current_time tx_time_get cycle_time current_time - start_time total_speedy_time total_speedy_time cycle_time Define the activities for the Consumer Slow thread. void Slow_Thread_entry ULONG thread_input UINT status ULONG start_time current_time cycle_time while 1 Get the starting time for this cycle start_time tx_time_get Activity 5 - get an instance of the counting semaphore with suspension and hold it for 12 timer-ticks. status tx_semaphore_get my_semaphore TX_WAIT_FOREVER if status TX_SUCCESS break Check status

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.