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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started