National Institute of Standards and Technology
Package illustrating a test case

Test case 150502

Description

This test case implements a singleton struct without synchronization that can lead to two threads receiving separate instances of the singleton struct resulting in a deadlocked state. It takes a control integer, the names of two control files, and another integer as input. The control integer and the two control files are used for timing within the test case to ensure that it hits either a good or bad case, and the input integer is used as the number of integers to pass through the queue. The test case then spawns two threads, one to push the numbers 0 to the input integer to a queue, and one to read the values from the queue and print them to the output stream. The shared queue is implemented as a singleton and is a blocking queue, if both threads create a separate instance of the singleton they will block indefinitely causing a deadlock.
Metadata
- Base program: Tree
- Source Taint: SHARED_MEMORY
- Data Type: SIMPLE
- Data Flow: BASIC
- Control Flow: SEQUENCE

Flaws

Test Suites

Documentation

Have any comments on this test case? Please, send us an email.