Distributed Shared Memory (DSM) systems provide a logically shared memory over physically distributed memory to enable parallel computation on Networks of Workstations (NOWs). In this paper, we propose an infrastructure for DSM systems to utilize idle cycles in the network by thread migration. To maintain high portability and flexibility, a generic thread migration package, MigThread, is implemented at language level. At compile-time, a preprocessor scans C programs to build thread state, detects possible thread adaptation points, and transforms the source code accordingly. At runtime, MigThread moves DSM threads around to utilize idle cycles on remote machines. Since the physical thread state is transformed into a logical form, MigThread is ready to be used in heterogeneous DSM systems. We implemented MigThread in a DSM system Strings. A comparison with other migration schemes and some performance measurements on real applications are reported to show the efficiency. Key Words: Sof...