For this week, please describe in your own words what multithreading is and how can multiple threads run simultaneously on a single-processor system? Provide small code example and the result/output of running your code to demonstrate this behavior. Write a few sentences explaining your code and the result/output of running your code.
Multithreading:
Multithreading is running multiple functions or methods
at a time i.e multiple independent tasks are performed
parallely.These tasks run in threads.
C++ code is explained in commments:
#include <thread>
#include <iostream>
using namespace std;
void task1() { //create task 1 which will be run by thread
1
for(int i=0;i<5;++i){//lets do this to check task1 progress by
task1
cout<<"Task1 :"<<i<<endl;
}
}
void task2() { //create task2 which will run by thread 2
for(int i=0;i<5;++i){//lets do this to check task1 progress by
task2
cout<<"Task2 :"<<i<<endl;
}
}
int main (int argc, char ** argv) {
thread thread_1(task1);//run thread1 calls task1 function or method
independently without blocking the next instruction
thread thread_2(task2);//now it will run thread2 calls task1
function or method independently
thread_2.join(); //you can wait here all threads to
complete
thread_1.join();
return 0;
}
From below output task1 and task2 outputs parallely by thread 1
and thread2
//output:

For this week, please describe in your own words what multithreading is and how can multiple...
Encoder what are the input signals? Describe the behavior of a Encoder in your own words, be sure to list the type and how may of each input,output signals. What is the relationship between the number and type of input and output signals?
In your own words, describe the four different types of social support and provide an example of each type as it relates to a health behavior. Describe the differences between perceived and actual social support and include a discussion about which is more important and why. Make sure to support your ideas with at least two reputable references that follow APA format hun
In your own words, define systematic, naturalistic, and structured observations. Describe the limitations of each. Are there certain behaviors that might be difficult to observe? Why? Give an example of that behavior.
Can you please use your own words thank you List and describe (in your own words) three of the crucial keys to development of an effective ethics program
be original and use your own words Describe at least 10 things you did this week to be part of the green clothing solution. Describe the areas you see you need to improve in. Add your reference
Mathematically and in your own words describe the difference between impulse and momentum. What is the relationship between them? In your discussion relate how this affects a bouncing object. Can you give an example of a bouncing object that would experience an elastic, inelastic, and perfectly inelastic collisions? Give an example when momentum is conserved and a situation when momentum is NOT conserved. Please write 7-10 complete sentences addressing these topics.
Please briefly (25-50 words) describe (in your own words) the “generic strategy” associated with the first letter of your last name (listed below) Please provide (50-100 words) an example of an organization with the generic strategy associated with the first letter of your last name (listed below) and explain how that organization may create its competitive advantage. A-D: Low Cost
In your own words describe the term liquidity preference. Provide an example from your personal finances
In your own words, describe inequity theory. In your opinion, what is an example of a way to correct inequity tension? Use an example.
In your own words describe an algorithm for a simple process you have done this week (e.g. washing your car). Remember that an algorithm is just a set of simple instructions that can be followed by a computer (or person) to complete a larger task!