[WEBINAR] Application Acceleration: Faster Performance for End Users

Threaded Code

Definition - What does Threaded Code mean?

Threaded code is a compiler implementation technique that is used to implement virtual machine interpreters. The code that is generated by the threaded code mostly contains calls to subroutines. This code could also be a simple sequence of machine call instructions or perhaps a code that needs to be processed by a machine interpreter. Threaded code is the implemented method in programming languages like FORTH, most implementations of BASIC and some versions of COBOL. One of the prominent features of threaded code is that compared to other code generation methods, it has a higher code density. At the same time, the execution speed is slightly slower than the codes generated by alternative methods.

Techopedia explains Threaded Code

Threaded code is mostly implemented using the following models:

  • Direct Threaded Code: The program code is a normal vector of procedure pointers to call arranged in the order in which they appear.
  • Indirect Threaded Code: Makes the representation of the compiled program with the help of address pointers. The representation makes use of vector of addresses to descriptors and not the addresses of the execution code. The descriptors, in turn, point to intended execution code.
  • Subroutine Threaded Code: Compared to other methods, subroutine threaded code has code representations that can be executed directly by the CPU. In this method, the vector used consists of JSR or CALL instructions instead of a vector of addresses.
  • Token Threaded Code: Makes use of the ThreeStarProgramming approach for interpreting the compiled representations. The representations are mostly restricted to less than 256 virtual instructions. As a result of this restriction, token threaded code is also known as byte code.

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.