lec09_zlab2thread - Real-Time Thread RTOS Task NOT...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Real-Time Thread RTOS Task • NOT necessarily responsible everything • A big system can be partitioned into multiple functions running simultaneously • One person can focus on only one function • RTOS thread help this
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 RTOS Support Interrupt Management rtl_request_irq rtl_free_irq rtl_hard_enable_irq rtl_hard_disable_irq Time Management clock_gethrtime clock_gettime clock_settime gethrtime nanosleep Task Management pthread_create pthread_setschedparam// pri. sched pthread_make_periodic_np pthread_wait_np pthread_delete_np pthread_cancel pthread_join Task Communication FIFO Shared Memory Signal Mutual Exclusion Lock Semaphore Device drivers rt_com rtsock RtLinux Architecture
Background image of page 2
3 Periodic task with thread First method (1) • Create thread – In “int init_module()” ----- called by “insmod” • #include <pthread.h> • int pthread_create(pthread_t * thread, pthread_attr_t * attr, void * (*start_routine)(void *), void * arg); – How to transfer arguments (e.g., priority, period, etc.)? • Run thread ------ • Delete thread – In “cleanup_module()” ----- called by “rmmod” • int pthread_cancel(pthread_t thread_id); • int pthread_join(pthread_t thread_id, void **thread_return); Periodic task with thread First method (2) • Set thread scheduling parameters – p.sched_priority = interger number; • larger number = higher priority • int sched_get_priority_min (int policy); // try SCHED_FIFO policy • int sched_get_priority_min (int policy); – int pthread_setschedparam(pthread_t thread_id, int policy, const struct sched_param *param); • pthread_t pthread_self(void);
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/02/2008 for the course COMPUTER S 664 taught by Professor Leechangkyu during the Spring '08 term at Korea University.

Page1 / 7

lec09_zlab2thread - Real-Time Thread RTOS Task NOT...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online