Glossary Updates12 new terms added to the glossaries · October 2, 2026, 22:44 CEST
AI TechDocKnowledge

Glossary · Automation software engineering and architecture

Coroutine

German: Koroutine

In programming, a coroutine is a routine that can suspend its execution at defined points and later resume from where it stopped, keeping its local state, which allows several activities to be interleaved cooperatively within a single thread.

  • Software engineering

In one sentence

A coroutine can suspend execution at defined points and resume later with its local state, enabling cooperative interleaving.

Example

An edge application uses coroutines to wait for responses from 50 devices concurrently in one thread, instead of starting one thread per device.

How it applies

  • Engineering: Coroutines, often written with async/await syntax, suit I/O-bound work such as network communication, where most time is spent waiting. They avoid the overhead and locking complexity of many threads.
  • Automation context: PLC programs do not use coroutines directly, but the idea is similar to step sequences: a sequence waits in a step and continues in a later cycle. Edge applications, gateways and test tools written in Python, C#, C++ or Kotlin often use coroutines.
  • Documentation: Developer documentation should state which functions are asynchronous, what they may wait for and how cancellation and Timeout handling work. Blocking calls inside a coroutine stall all others in the same thread, a common and hard-to-diagnose error.

Coroutine vs. thread

Threads are scheduled by the operating system and can run in parallel or be preempted at any time. Coroutines switch only at explicit suspension points and run within one thread unless the framework distributes them. Coroutines are a form of Cooperative scheduling.

By knowledge.aitechdoc.world · Published September 26, 2026 · Last reviewed

Source: AI TechDoc Blog editorial definition, based on programming language practice

Definitions follow the cited standards and specifications. Where a source is a copyrighted publication, such as an ISO, IEC or EN standard, the definition is a close paraphrase, not a verbatim quotation, so as not to infringe copyright. We recommend reading the original publication. The sections “How it applies” are editorial commentary by AI TechDoc Blog and are not part of any standard.

Seen a mistake? Send us a note!