As discussed above, Deadlock is a major issue that usually comes
up while multithreading. To avoid this up to a certain extent and also manage
the flow of sub-threads, each thread gets associated with a priority.
When a thread starts its priority it can either be set by
the programmer or by the operating system. In a locking situation the highest
priority thread usually locks the system by keeping the resources engaged,
while other low priority threads keep waiting for it. This creates a locking
situation.