Intel® Cilk™ Plus is a deprecated feature. Use OpenMP* or Intel® Threading Building Blocks instead. For more information see Migrate Your Application to use OpenMP* or Intel® TBB Instead of Intel® Cilk™ Plus.

You can use various synchronization mechanisms in the hardware or operating system.

The following lock terms and facts are useful:

  • The following terms are interchangeable: "acquiring", "entering", or "locking" a lock (or "mutex").

  • A strand (or thread) that acquires a lock is said to "own" the lock.

  • Only the owning strand can "release", "leave", or "unlock" the lock.

  • Only one strand can own a lock at a time.

  • tbb::mutex is implemented using underlying OS mutex operations.

Lock contention can create performance problems in parallel programs. Additionally, while locks can resolve data races, programs using locks are often non-deterministic. Avoiding locks whenever possible is recommended.

These problems (and others) are described in detail in the following sections.

有关编译器优化的更完整信息,请参阅优化通知