Why are malloc() and printf() said as non-reentrant?
malloc and printf usually use global structures, and employ lock-based synchronization internally. That’s why they’re not reentrant. The malloc function could either be thread-safe or thread-unsafe. Both are not reentrant: Malloc operates on a global heap, and it’s possible that two different invocations of malloc that happen at the same time, return the same memory … Read more