What is a multi-threaded version of the C runtime library

zhaozj2021-02-16  59

When the C runtime library is generated in the 1970s, the memory capacity of the PC is still small, and the multitasking is a novel concept, let alone how much threads. Therefore, the C runtime function library evolved at the time of the product has a serious problem in the performance of multithreaded, and cannot be used by multi-threaded programs.

Using a variety of synchronization mechanisms such as Critical Section, Mutex, Semaphore, Event, you can re-develop a set of Runtime libraries that support multi-threaded multithreaded. The problem is, plus such capabilities, may result in poor wave in size and execution efficiency - even if you only activate a thread.

The Visual C compromise is to provide two versions of the C Runtime library. A version is used to a single-threaded program, a version to multi-threaded program. The major changes in multi-threaded versions are: First, variables such as Errno now become one of each thread. Second, the data structure in the multi-line version is protected by a synchronous mechanism.

Visual C has six c runtime library products for you to choose:

◆ Single-Threaded (static) libc.lib 898, 826

◆ Multithreaded (static) libcmt.lib 951,142

◆ Multithreaded DLL MSVCRT.LIB 5,510,000

◆ Debug Single-Threaded (static) libcd.lib 2,374,542

◆ Debug Multithreaded (static) libcmtd.lib 2,949,190

◆ Debug Multithreaded DLL MSVCRTD.LIB 803, 418

The Visual C compiler provides the following options to make us decide which C Runtime library:

◆ / ml Single-Threaded (static)

◆ / MT Multithreaded (static)

◆ / MD Multithreaded DLL (Dynamic Import Library)

◆ / MLD Debug Single-Threaded (static)

◆ / MTD Debug Multithreaded (static)

◆ / MDD Debug Multithreaded DLL (Dynamic Import Library)

转载请注明原文地址:https://www.9cbs.com/read-16191.html

New Post(0)