Nova+Nul one Execution Context suspend a second Execution Context

Nils Asmussen nils at os.inf.tu-dresden.de
Wed Dec 12 20:13:08 CET 2012


Hi Mehdi,

your example can't work. NOVA has local Ecs and global Ecs. The first 
ones are only responsible for handling portal calls and don't have time. 
The others have time (you give them time by binding a scheduling context 
to them) and therefore run "on their own".

Probably you have created two global Ecs (running the while loop) and 
one local Ec that handles the portal-call. If the first global Ec calls 
the portal, the local Ec wakes up, executes the portal and goes back to 
sleep. Thus, it has nothing to do with the other global Ec, which is the 
reason why it isn't blocked.

Can you explain what you really want to do? Because suspending the 
worker thread doesn't really make sense to me :)

Btw, if you only want to play around with it and don't have 
sophisticated virtualization requirements, I would recommend to try out 
NRE (https://github.com/TUD-OS/NRE), because NUL isn't maintained 
anymore. NRE does not yet support everything NUL supports, but it is a 
lot simpler to use and when you just want to play around with Ecs, 
portals and that stuff, it is really better suited for that task, I think.

Best regards,
Nils



> Hello Alexander,
>
> I  wrote a simple example to test the NOVA+NUL.
> In my example, I created two Execution Contexts.
>
> When the the first Execution Context starts, it obtains a portal capability to
> the second Execution Context, and run a while(true) loop as follow :
>
> ...
> while(1)
> {
> Logging::printf("#tsc=%llu\n", now);	
> nova_call(pt);
> }
> ...
>
> The second Execution Context run also a while(true) loop as follow:
>
> ...
> while(1) {
> count++;
> Logging::printf("WorkerThread is working... count= %u\n", count);
> }
> ...
>
> The first Execution Context call the second Execution Context. When the second Execution Context
> receive the call in its portal function, it calls the msleep( ) function on a TimerHelper instance
> that it has already created:
>
> unsigned portal_func(Utcb &utcb, Utcb::Frame &input, bool &free_cap, cap_sel pid)
> {	
> Logging::printf("Thread will sleep... count=%u\n", count);
> timer->msleep(1000);
> return ENONE;
> }
>
> The problem is that, it is the first Execution Context who is blocked and not the
> second Execution Context.
>
> Could anyone please give me an example of how can I achieve the inverse case, where the first EC continue running
> and suspends the second EC.
>
> this is my code to obtain the portal:
>
> cap_sel pseudonym = alloc_cap();
> res = ParentProtocol::get_pseudonym(*utcb, "s0/ec2", 0, pseudonym);
> cap_sel pt = alloc_cap();
> res = ParentProtocol::get_portal(*utcb, pseudonym, pt, true, "s0/worker_thread");
>
> Thank you in advance.
>
> Mehdi
>
>
> _______________________________________________
> l4-hackers mailing list
> l4-hackers at os.inf.tu-dresden.de
> http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
>





More information about the l4-hackers mailing list