예제 #1
0
//import "time"
func main() {
	numprocs := 10
	numtasks := 10000
	numconc := 100

	end := make(chan int)
	theend := make(chan int)

	distconfig.ReadAndParseConfig("services.yaml")
	hosts := distconfig.GetHostsConfig()
	portdist := make([][]distio.PortBaby, numprocs)
	sendchans := make([]chan *distio.OutMessage, numprocs)
	for i := 0; i < numprocs; i++ {
		portdist[i] = make([]distio.PortBaby, len(hosts))
		sendchans[i] = make(chan *distio.OutMessage, 10)
		index := 0
		for _, v := range hosts {
			portdist[i][index].CreateConn(v.Hostname, v.Port, "tcp")
			//print("Creating",v.Hostname,":",v.Port,"\n");
			index++
		}
		go distribute(portdist[i], sendchans[i], end)
	}

	go EndTask(portdist, numtasks, end, theend)
	cncount := numtasks / numconc
	for i := 0; i < numconc; i++ {
		go Concurrents(cncount, sendchans, i*cncount)
	}
	_ = <-theend
}
예제 #2
0
//import "strconv"
func main() {
	distconfig.ReadAndParseConfig("services.yaml")
	hosts := distconfig.GetHostsConfig()
	endchan := make(chan int)
	// Create the Port Managers
	for _, v := range hosts {
		go distio.CreateTaskServer(v.Port, endchan)
	}

	//result := 0
	for i := 0; i < len(hosts); i++ {
		_ = <-endchan
	}
}