Figure 1 and Listing Two show the echo agent state machine and program code. It is feasible, but not very practical, to build an SMT agent program without Libero. State machine for echo agent. The number of threads is limited only by the memory available to the process. As far as the operating system is concerned, there is just one process, so there is a lower cost.
Many operating systems provide native multithreading internally.
However, native multithreaded applications are not really portable and are quite difficult to program. One typical problem with multithreaded programming is that threads must do extra work to synchronize access to shared resources such as data. If you do not take care of this, a program may work well during testing, then fail under heavy use. Threads are only switched at well-specified boundaries. All code between these boundaries can safely access common resources.