A simple form of queue management is NaviServer's job queue. If one creates such a queue with a single thread associated, jobs in this queue are serialized, and no two jobs can be executed in parallel
#
# Create a job queue named "q1" with a single thread (do this only once)
#
ns_job create q1 1
#
# Add some jobs to this queue. Every job takes about 2
# seconds and writes then a message to the log file
# for demonstration purposes.
#
for {set i 1} {$i<10} {incr i} {
ns_job queue -detached q1 {ns_sleep 2; ns_log notice hi}
}