Knowledge

Channel (programming)

Source 📝

611:
CSO -- Communicating Scala Objects is a complete DSL for channel-based communication and concurrency whose semantic primitives are generalizations of the OCCAM primitives. CSO has been used since 2007 in the teaching of concurrent programming, and relevant lectures can be found with the ThreadCSO
331:
code performs similarly to the XC code. First the channel c is created, then a goroutine is spawned which sends 42 through the channel. When the number is put in the channel x is set to 42. Go allows channels to buffer contents, as well as non blocking receiving through the use of a select block.
263:
In this example, two hardware threads are started on the XMOS, running the two lines in the "par" block. The first line transmits the number 42 through the channel while the second waits until it is received and sets the value of x. The XC language also allows asynchronous receiving on channels
104:
programming language implements channels with push and pop operations similar to stacks. The pop operation will block so as long as there is data resident on the stack. A demand operation is equivalent to pop, except it will block until there is data on the
585:
In addition to their fundamental use for interprocess communication, channels can be used as a primitive to implement various other concurrent programming constructs which can be realized as streams. For example, channels can be used to construct
83:
event module offers typed channels for synchronization. When the module's send and receive functions are called, they create corresponding send and receive events which can be synchronized.
821:"stlab is the ongoing work of what was Adobe's Software Technology Lab. The Adobe Source Libraries (ASL), Platform Libraries, and new stlab libraries are hosted on github" 404:
provides asynchronous channels for communication between threads. Channels allow a unidirectional flow of information between two end-points: the
744: 774: 712: 877: 625:
This implementation supports splits, and different merge and zip operations. Different executors can be attached to the individual nodes.
64: 200:-- in that case use :demand() instead of :pop() because :demand() will block until there is data on the stack and then return the data. 590:, where a future is a one-element channel, and a promise is a process that sends to the channel, fulfilling the future. Similarly, 645: 622: 60: 43:. A message may be sent over a channel, and another process or thread is able to receive messages sent over a channel it has a 872: 756: 724: 260:
provides a primitive type "Chan" and two operators "<:" and ":>" for sending and receiving data from a channel.
852: 197:-- Because the channel can be popped from before the thread first executes, there may not be data on the stack. 44: 401: 837: 51:. Different implementations of channels may be buffered or not, and either synchronous or asynchronous. 101: 32: 741: 328: 257: 684: 17: 857: 709: 194:-- The thread will block until "Hello world!" is popped off channel test's stack. 68: 97: 587: 8: 110:-- A string containing code which will be interpreted by a function such as loadstring(), 649: 48: 670: 16:
This article is about software interprocess communication. Not to be confused with
760: 748: 728: 716: 40: 36: 847: 866: 753: 721: 820: 21: 128:
love.thread.getChannel("test"):push("Hello world!")
799: 591: 71:, offers inter-thread communication based on fixed-size channels. 842: 603:
List of non-standard, library based implementations of channels
80: 253: 67:, which was first created for the operating system 864: 113:-- but on the C side to start a native thread. 671:"Effective Go - the Go Programming Language" 594:can be constructed directly from channels. 597: 848:Limbo – Inferno Application Programming 865: 797: 772: 54: 646:"XMOS Programming Guide | XMOS" 13: 878:Go (programming language) software 14: 889: 831: 838:Libthread Channel Implementation 580: 74: 813: 798:Sufrin, Bernard (2021-07-13), 791: 773:Sufrin, Bernard (2021-07-13), 766: 734: 702: 677: 663: 638: 1: 631: 239:-- The thread can now finish. 91: 685:"Channels - Rust By Example" 264:through a select statement. 7: 873:Inter-process communication 86: 10: 894: 247: 33:interprocess communication 15: 843:Bell Labs and CSP Threads 853:Stackless.com – Channels 414: 334: 266: 107: 18:Channel (communications) 598:List of implementations 396: 100:library which uses the 322: 256:programming language 754:Go Language Patterns 722:Go Language Patterns 588:futures and promises 149:-- Start the thread. 759:2020-11-11 at the 747:2020-10-15 at the 727:2020-11-11 at the 715:2020-12-04 at the 55:libthread channels 689:doc.rust-lang.org 885: 825: 824: 817: 811: 810: 809: 808: 795: 789: 788: 787: 786: 781: 770: 764: 738: 732: 706: 700: 699: 697: 695: 681: 675: 674: 667: 661: 660: 658: 657: 648:. Archived from 642: 576: 573: 570: 567: 564: 563:"{:?}" 561: 558: 555: 552: 549: 546: 543: 540: 537: 534: 531: 528: 525: 522: 519: 516: 513: 510: 507: 504: 501: 498: 495: 491: 488: 485: 481: 478: 475: 472: 469: 466: 463: 460: 457: 454: 451: 448: 445: 442: 438: 435: 432: 429: 425: 421: 418: 411: 407: 392: 389: 386: 383: 380: 377: 374: 371: 368: 365: 362: 359: 356: 353: 350: 347: 344: 341: 338: 327:This snippet of 318: 315: 312: 309: 306: 303: 300: 297: 294: 291: 288: 285: 282: 279: 276: 273: 270: 243: 240: 237: 234: 231: 228: 227:"test" 225: 222: 219: 216: 213: 210: 207: 204: 201: 198: 195: 192: 189: 186: 183: 180: 177: 174: 171: 168: 165: 162: 159: 156: 153: 150: 147: 144: 141: 138: 135: 132: 129: 126: 123: 120: 117: 114: 111: 27:In computing, a 893: 892: 888: 887: 886: 884: 883: 882: 863: 862: 834: 829: 828: 819: 818: 814: 806: 804: 796: 792: 784: 782: 779: 771: 767: 761:Wayback Machine 749:Wayback Machine 739: 735: 729:Wayback Machine 717:Wayback Machine 707: 703: 693: 691: 683: 682: 678: 669: 668: 664: 655: 653: 644: 643: 639: 634: 612:implementation. 600: 583: 578: 577: 574: 571: 568: 565: 562: 559: 556: 553: 550: 547: 544: 541: 538: 535: 532: 529: 526: 523: 520: 517: 514: 511: 508: 505: 502: 499: 496: 493: 489: 486: 483: 479: 476: 473: 470: 467: 464: 461: 458: 455: 452: 449: 446: 443: 440: 436: 433: 430: 427: 423: 419: 416: 409: 405: 399: 394: 393: 390: 387: 384: 381: 378: 375: 372: 369: 366: 363: 360: 357: 354: 351: 348: 345: 342: 339: 336: 325: 320: 319: 316: 313: 310: 307: 304: 301: 298: 295: 292: 289: 286: 283: 280: 277: 274: 271: 268: 250: 245: 244: 241: 238: 235: 232: 229: 226: 223: 220: 217: 214: 211: 208: 205: 202: 199: 196: 193: 190: 187: 184: 181: 178: 175: 172: 169: 166: 163: 160: 157: 154: 151: 148: 145: 142: 139: 136: 133: 130: 127: 124: 121: 118: 115: 112: 109: 94: 89: 77: 57: 41:message passing 37:synchronization 31:is a model for 25: 12: 11: 5: 891: 881: 880: 875: 861: 860: 858:– OCaml Events 855: 850: 845: 840: 833: 832:External links 830: 827: 826: 812: 790: 765: 733: 701: 676: 662: 636: 635: 633: 630: 629: 628: 627: 626: 616: 615: 614: 613: 605: 604: 599: 596: 582: 579: 415: 398: 395: 335: 324: 321: 267: 249: 246: 108: 93: 90: 88: 85: 76: 73: 61:multithreading 56: 53: 9: 6: 4: 3: 2: 890: 879: 876: 874: 871: 870: 868: 859: 856: 854: 851: 849: 846: 844: 841: 839: 836: 835: 823:. 2021-01-31. 822: 816: 803: 802: 794: 778: 777: 769: 763: 762: 758: 755: 750: 746: 743: 737: 731: 730: 726: 723: 718: 714: 711: 705: 690: 686: 680: 672: 666: 652:on 2016-03-04 651: 647: 641: 637: 624: 621: 620: 618: 617: 610: 609: 607: 606: 602: 601: 595: 593: 589: 413: 403: 333: 330: 265: 261: 259: 255: 106: 103: 99: 84: 82: 72: 70: 66: 62: 52: 50: 46: 42: 38: 34: 30: 23: 19: 815: 805:, retrieved 800: 793: 783:, retrieved 775: 768: 752: 736: 720: 704: 692:. Retrieved 688: 679: 665: 654:. Retrieved 650:the original 640: 584: 581:Applications 400: 326: 262: 251: 95: 78: 75:OCaml events 58: 28: 26: 694:28 November 608:For Scala: 22:I/O channel 867:Categories 807:2023-02-17 785:2023-02-17 656:2015-05-10 632:References 221:getChannel 176:threadCode 119:threadCode 92:Lua Love2D 801:ThreadCSO 776:ThreadCSO 742:Iterators 619:For C++: 592:iterators 170:newThread 65:libthread 63:library, 47:to, as a 45:reference 757:Archived 745:Archived 725:Archived 713:Archived 557:println! 410:Receiver 408:and the 134:function 87:Examples 710:Futures 484:channel 248:XMOS XC 29:channel 569:result 539:result 527:unwrap 490:thread 441:thread 406:Sender 233:demand 215:thread 182:thread 164:thread 152:thread 98:Love2D 69:Plan 9 49:stream 780:(PDF) 623:stlab 494:spawn 388:<- 373:<- 308::> 296:<: 203:print 188:start 116:local 105:stack 81:OCaml 696:2020 551:recv 515:send 500:move 480:mpsc 450:main 428:mpsc 424:sync 402:Rust 397:Rust 361:func 349:chan 343:make 269:chan 254:XMOS 252:The 209:love 158:love 143:load 137:love 96:The 79:The 59:The 39:via 35:and 751:", 719:", 554:(); 536:let 533:}); 530:(); 521:123 487:(); 459:let 437:std 434:use 420:std 417:use 379:}() 352:int 287:par 278:int 242:end 236:()) 102:Lua 20:or 869:: 687:. 572:); 545:rx 524:). 509:tx 503:|| 492::: 482::: 471:rx 465:tx 453:() 447:fn 439::: 426::: 422::: 412:. 385::= 376:42 364:() 358:go 340::= 329:Go 323:Go 299:42 258:XC 230:): 191:() 146:() 131:]] 125:[[ 740:" 708:" 698:. 673:. 659:. 575:} 566:, 560:( 548:. 542:= 518:( 512:. 506:{ 497:( 477:= 474:) 468:, 462:( 456:{ 444:; 431:; 391:c 382:x 370:c 367:{ 355:) 346:( 337:c 317:} 314:; 311:x 305:c 302:; 293:c 290:{ 284:; 281:x 275:; 272:c 224:( 218:. 212:. 206:( 185:: 179:) 173:( 167:. 161:. 155:= 140:. 122:= 24:.

Index

Channel (communications)
I/O channel
interprocess communication
synchronization
message passing
reference
stream
multithreading
libthread
Plan 9
OCaml
Love2D
Lua
XMOS
XC
Go
Rust
futures and promises
iterators
stlab
"XMOS Programming Guide | XMOS"
the original
"Effective Go - the Go Programming Language"
"Channels - Rust By Example"
Futures
Archived
Wayback Machine
Go Language Patterns
Archived
Wayback Machine

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.