Question: Assembly language problem. We have a function findharshadnum, and we take number of threads from user, varying from 1 to 4. Im having problems in

Assembly language problem. We have a function findharshadnum, and we take number of threads from user, varying from 1 to 4. Im having problems in calling the threads depending on what user requires Below code is what i have in calling th threads, how do i call them correctly?

Note thdCount holds user number of threads.

cmp dword[thdCount],1 je th1 cmp dword[thdCount],2 je th2 cmp dword[thdCount],3 je th3 th4: mov rdi, pthreadID3 mov rsi, NULL mov rdx, findHarshadNums mov rcx, NULL call pthread_create

mov rdi, qword [pthreadID3] mov rsi, NULL call pthread_join th3: mov rdi, pthreadID2 mov rsi, NULL mov rdx, findHarshadNums mov rcx, NULL call pthread_create

mov rdi, qword [pthreadID2] mov rsi, NULL call pthread_join th2: mov rdi, pthreadID1 mov rsi, NULL mov rdx, findHarshadNums mov rcx, NULL call pthread_create

mov rdi, qword [pthreadID1] mov rsi, NULL call pthread_join th1: mov rdi, pthreadID0 mov rsi, NULL mov rdx, findHarshadNums mov rcx, NULL call pthread_create ; YOUR CODE GOES HERE ; call other threads as needed based on user provided thread count.

; ----- ; Wait for thread(s) to complete. ; pthread_join (pthreadID0, NULL);

WaitForThreadCompletion: mov rdi, qword [pthreadID0] mov rsi, NULL call pthread_join

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!