Cilk Plus Scheduler and compilation strategy

Cilk Plus Scheduler and compilation strategy

Hi,I have a few questions about the scheduler of Cilk Plus and about it's program execution.I read a paper about the "two-clone" compilation strategy implemented in Cilk 5 and was wondering if that is still a part of Cilk Plus. Unfortunately i did not find any information about how the Cilk Plus programs are compiled. Are there papers available?The paper i mentioned is available at, is the work-stealing scheduler implemented in Cilk 5 the same as in Cilk Plus? I saw a presentation where it seemed toslightlydiffer in the sense that the original Cilk used heaps as ready-deques and Cilk Plus uses multiple stacks. Is that the only difference? Why were stacks implemented instead of heaps?The mentioned presentation is abailable at in advance,Leif Blaese

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Leif.

I can't speak too much to what Cilk 5 did, but I can tell you about Cilk++ and Cilk Plus.

Cilk++ was developed by a company called Cilk Arts which licensed the Cilk technology from MIT. It implemented a C++ variant of Cilk using the same strategy of allocating frames from the heap as Cilk 5. While that maintained the space guarantees tht Cilk 5 provided, it proved difficult for customers to use. While you could call C or C++ functions directly from Cilk functions with frames allocated on the heap, you couldn't call directly from C or C++ to a Cilk function. This meant you couldn't use them for callbacks. And you don't want to know about the problems we had with templated functions.

When Cilk Arts was acquired by Intel, one of our priorities was to fix the linkage problem. The solution was to keep standard, stack-based calls. When a continuation is stolen, execution moves onto a new stack. When the function is synced, execution resumes on the original stack. This loosens the space guarantee, but it means that you can call a spawning function (a function containing a cilk_spawn'd call) directly from C or C++.

Cilk 5 was a preprocessor that produced C code. Intel Cilk Plus is implemented directly in the Intel C/C++ compiler. This gives us a number of benefits:

  • Debugging is *MUCH* easier since the debug symbols correlate with your code, not the preprocessed code.
  • The compiler can generate better code.

In place of the "two clone" method implemented by Cilk 5, there's only one copy of a function containing a Cilk keyword. Continuation of a function is implemented using setjmp/longjmp. You can see many of the details in the Intel Cilk Plus Specifications which are available at

- Barry

Leave a Comment

Please sign in to add a comment. Not a member? Join today