views:

30

answers:

1

I'm studying pascal-fc for a concurrency test.

I'm familiar with Java's threads and its monitors.

I don't understand the role of channels, please explain.

+2  A: 

A channel is a kind of object that links a receiver and a sender.

In Pascal-FC they are strongly typed: you have to declare what kind of object they allow to be sent and received. You can really imagine them as channels in the sense that a process opens a channel of integers with another process: it will be able to send and receive integers from that channel, and the other process too.

It's a communication device on which you can do mainly 2 operations:

  • send, defined as channel_var ! expression
  • receive, defined as channel_var ? variable
Jack