l4/sys/syscalls.h: No such file or directory
adam at os.inf.tu-dresden.de
Sun Aug 24 23:27:51 CEST 2014
On Sat Aug 23, 2014 at 15:12:01 +0200, Valentin Hauner wrote:
> On 08/21/2014 11:49 PM, Adam Lackorzynski wrote:
> > The main issue is that you start 2 threads and then immediately leave
> > the main function, which exits your program and would also destroy all
> > threads. But it does not get so far...
> > Each thread needs to have a unique UTCB. In this example, you could fix
> > it like this:
> > l4re_env()->first_free_utcb = (l4_addr_t)l4re_env()->first_free_utcb + L4_UTCB_OFFSET;
> > Remember that the size of the initial UTCB area is limited, so this only
> > works a few times (allocating more is possible).
> > As both threads use the same UTCB this could result in the behavior
> > you're seeing.
> I've tried both of your suggestions, but none of them solved the problem.
> Then I've added
> > l4re_util_cap_free_um(thread_caps[x]);
> at the end of each thread function and now the exception does not appear
> any more. All output ("Hello World ...") is produced as supposed to be.
> I've attached the modified source file for your convenience. Note that
> the idling of the main thread (lines 109 f.) as well as the manipulation
> of first_free_utcb (line 99) are _commented out_.
> Obviously, both created threads can go on although the main thread has
> already ended? Why?
> Is it right that the manipulation of first_free_utcb is necessary only
> when there is any IPC? In my example, none of the threads is
> communicating via the message registers.
The threads are doing printf which does an IPC implicitly. What happens
is that first thread runs to its end and then the second runs, so they
do not overlap during their runtime. It is just too short and they're
not sleeping between the printfs.
I've tried you example and it works as I think it should work (omitting
the Deadline parameter). Immediate exit with no waiting in main() and
with waiting 2 times 10 lines of each thread.
I suggest that you first make sure you program behaves like it should
with the default scheduler, and only then change over to your scheduler.
Adam adam at os.inf.tu-dresden.de
More information about the l4-hackers