[ Foro de C# ]

Multithreading

16-May-2016 23:55
Invitado (Diego)
0 Respuestas

Hola,

Alguien podria ayudarme con estos ejercicios? Llevo algunos dias tratando de hacerlos y no encuentro la forma.

1. Write the software in the console application, the cooperation between the three threads, which consists of a console-printing of their characters. Each of the three threads on the console prints one letter: thread 1 ? "a" thread 2 - "b", the thread 3 - "c". Three threads are output to the console the following sequences:
1.1.aaa bbb ccc aaa bbb ccc ...,
1.2.abc abc abc ...,
1.3.abb acc caa cbb baa bcc ...,
1.4.acb abc bac bca ....

Printing sequence on the console realize alternatively.

2. Time measurement and timely calls. Write the software in the console application, implementing timing and calls of threads at a specific time, eg. at 500, 250 and 125 ms. Write to the console information about the measurement of time and timely call to the thread. You can use the application to prepare the exercise. 1. To do this, use the name space System.Timer or System.Treading and environment variable Environment.TickCount and a object of Timer () class.

An example of the sequence of calls of threads, written on the console:

Start Tread a ... 125ms

Start Tread b ... 250ms

Start Tread c ... 500ms

Awake Tread a ... 125ms ... 1one ? real time wakeup xxxxxx1

Awake Tread b ... 250ms ... 1one ? real time wakeup xxxxxx

Awake Tread a ... 125ms ... 2one ? real time wakeup xxxxxx

Awake Tread a ... 125ms ... 3one ? real time wakeup xxxxxx

Awake Tread c ... 500ms ... 1one ? real time wakeup xxxxxx

Awake Tread b ... 250ms ... 2one ? real time wakeup xxxxxx

Awake Tread a ... 125ms ... 4one ? real time wakeup xxxxxx

Awake Tread a ... 125ms ... 5one ? real time wakeup xxxxxx

Awake Tread b ... 250ms ... 3one ? real time wakeup xxxxxx

Awake Tread a ... 125ms ... 6one ? real time wakeup xxxxxx

Awake Tread a ... 125ms ... 7one ? real time wakeup xxxxxx

Awake Tread c ... 500ms ... 2one ? real time wakeup xxxxxx

Awake Tread b ... 250ms ... 4one ? real time wakeup xxxxxx

Awake Tread a ... 125ms ... 8one ? real time wakeup xxxxxx

Gracias de antemano.





(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)