Thread creation
Peter Nguyen
peter.nguyen at ...29...
Sat Jan 30 11:47:22 CET 2010
Hi,
So what i'm currently trying to do is that i'm trying to have a thread, whose
purpose is to initialize some more genode threads as it results in the page
faults for some reason. It seems that Genode doesn't like me creating and
starting thread instances by another thread (ie. main creates thread1 -> thread1
creates thread2), which I find weird if in actual fact that this actually is not
meant to work. I created and started an instance of thread2 in the main function
of my genode server, which resulted in that thread working, whereas creating and
starting an instance of thread2 in thread1 does not seem to work. I have a
question that may contribute to me coming up with a workaround to this problem.
Given that a thread may call a function that belongs to another class, is there
any way for me to obtain the ID of the thread that is currently executing? In
previous builds of OKL4, L4_Myself() could be used within a function which would
return the ID of the thread that was executing when the given function executes.
Peter
Quoting Stefan Kalkowski <stefan.kalkowski at ...1...>:
> Hi Peter,
>
> On Thursday, 28. January 2010 13:00:01 Peter Nguyen wrote:
> > Hi,
> >
> > In also trying to create a thread, there are some instances when i would
> > like to pass some parameters to a thread to establish a starting state for
> > a thread. To do this, the class i write, which inherits from Thread
> > contains some instance variables which get initialised in the class's
> > constructor. From there, when the thread starts execution, the function
> > that executes when the thread starts uses those variables i've declared.
>
> That's perfectly fine.
>
> > However, when I run genode with my app, i keep getting the following
> > message, which seems to result in the thread not executing at all:
> >
> > no RM attachment (READ pf_addr=562ae410 pf_ip=20145c6 from 08).
> >
>
> That means one of your threads raised a pagefault. "RM" stands for "region
> map" a datastructure that manages the mapping of virtual memory regions to a
> specific dataspace. If there is no region map, that corresponds to a virtual
> address, the pager is not able to back that virtual address with physical
> memory and you will get above error message.
>
> To determine where in your code the pagefault occurs you might have a look at
> the instruction given by the instruction pointer ("pf_ip"), as well as the
> location in the source code corresponding to that instruction. You can use
> objdump to have a look at the assembler code together with the corresponding
> C++ function and object member names:
>
> objdump -dC <your_binary>
>
> When using objdump with the '-C' flag your binary should not be stripped!
>
> > The code i have for this thread is the following:
> >
> > class collection1 : public Thread<4096>
> > {
> > public:
> > L4_ThreadId_t tid_block;
> > void thread_fn();
> > void entry();
> >
> > collection1(unsigned long value)
> > {
> > tid_block.raw = value;
> > }
> > };
> >
>
> Well, the most important parts would be the constructor and entry function
> code as well as the caller's context. Probably the pagefault occurs at one of
> these locations.
>
> > Yet when i instantiate this class, I get the "no RM attachment" message,
> > which results in this thread not executing at all. Does anyone know what is
> > happening? Can parameters be passed to a thread via its constructor?
> >
>
> yes, that's the recommended way.
>
> regards stefan
>
> PS: most mail clients and archive software use the "In-Reply-To" mail header
> to structure related mails in "threads". If you start a topic with a
> different subject, it would be nice, if you would not reply to a former mail
> of the list ;-)
>
> > Peter
> >
> > ---------------------------------------------------------------------------
> >--- The Planet: dedicated and managed hosting, cloud storage, colocation
> > Stay online with enterprise data centers and the best network in the
> > business Choose flexible plans and management services without long-term
> > contracts Personal 24x7 support from experience hosting pros just a phone
> > call away. http://p.sf.net/sfu/theplanet-com
> > _______________________________________________
> > Genode-main mailing list
> > Genode-main at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/genode-main
>
> --
> Stefan Kalkowski
> Genode Labs Developer
> http://genode-labs.com
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Genode-main mailing list
> Genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
>
More information about the users
mailing list