2008-02-29 11:56:05 problem: realtime, threads, processes comunication
Edwin Oyaga (GERMANY)
Message: 51908
Hi everybody,
I am writing a program, which consist of two threads. Thread_1 works periodically (every 2mSec) on incoming and outgoing data, and Thread_2 visualizes a menu and get commands from an operator. These commands should change the configuration on Thread_1.
I am using simple C-functions “int putchar(int c);” and “scanf(…)” for the visualization of the menu and the reception of commands.
The Problem is, when Thread_2 prints the whole menu (40 characters … more or less), Thread_1 kind of goes to sleep for a couple of mSecs and can not work on the incoming data.
So I think, I need some other way to visualize the menu, without interrupting Thread_1.
Has anyone any hints or suggestions?
Thanks in advance.
- Edwin
QuoteReplyEditDelete
2008-03-02 23:05:34 Re: problem: realtime, threads, processes comunication
Yi Li (CHINA)
Message: 51970 > The Problem is, when Thread_2 prints the whole menu (40 characters … more or less), Thread_1 kind of goes to sleep for a couple of mSecs and can not work on the incoming data.
you may set schedule policy of thread_1 as real-time (SCHED_FIFO/SCHED_RR), also increase the priority of thread_1. But it is not guaranteed to be waken up exactly every 2 ms. Linux is not hard realtime.