소스 검색

fix build on windows
heft ported to new interface
bugs fixes

Simon Archipoff 12 년 전
부모
커밋
65dd7325fa

+ 2 - 2
src/Makefile.am

@@ -230,8 +230,8 @@ libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES = 						\
 	sched_policies/node_work_stealing.c			\
 	sched_policies/prio_deque.c				\
 	sched_policies/bitmap.c					\
-	sched_policies/node_random.c				
-#	sched_policies/node_heft.c				\
+	sched_policies/node_random.c				\
+	sched_policies/node_heft.c				\
 	sched_policies/hierarchical_heft.c
 if STARPU_USE_CPU
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/cpu/driver_cpu.c

+ 1 - 1
src/core/sched_policy.c

@@ -36,7 +36,7 @@ static struct starpu_sched_policy *predefined_policies[] =
 	&_starpu_sched_tree_eager_policy,
 	&_starpu_sched_tree_random_policy,
 	&_starpu_sched_tree_ws_policy,
-//	&_starpu_sched_tree_heft_policy,
+	&_starpu_sched_tree_heft_policy,
 	&_starpu_sched_eager_policy,
 	&_starpu_sched_prio_policy,
 	&_starpu_sched_random_policy,

+ 1 - 1
src/core/sched_policy.h

@@ -68,5 +68,5 @@ extern struct starpu_sched_policy _starpu_sched_peager_policy;
 extern struct starpu_sched_policy _starpu_sched_tree_eager_policy;
 extern struct starpu_sched_policy _starpu_sched_tree_random_policy;
 extern struct starpu_sched_policy _starpu_sched_tree_ws_policy;
-//extern struct starpu_sched_policy _starpu_sched_tree_heft_policy;
+extern struct starpu_sched_policy _starpu_sched_tree_heft_policy;
 #endif // __SCHED_POLICY_H__

+ 5 - 0
src/sched_policies/bitmap.c

@@ -3,6 +3,11 @@
 #include <stdlib.h>
 #include <starpu.h>
 #include "bitmap.h"
+
+#ifndef LONG_BIT
+#define LONG_BIT (sizeof(unsigned long) * 8)
+#endif
+
 struct _starpu_bitmap{
 	unsigned long * bits;
 	int size;

+ 28 - 4
src/sched_policies/hierarchical_heft.c

@@ -104,7 +104,7 @@ static void remove_worker_heft(unsigned sched_ctx_id, int * workerids, unsigned
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&t->lock);
 }
 
-#else
+
 static void add_worker_heft(unsigned sched_ctx_id, int * workerids, unsigned nworkers)
 {
 	struct _starpu_sched_tree *t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
@@ -144,6 +144,7 @@ static void remove_worker_heft(unsigned sched_ctx_id, int * workerids, unsigned
 	}
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&t->lock);
 }
+#else
 #endif
 
 
@@ -153,12 +154,35 @@ static void initialize_heft_center_policy(unsigned sched_ctx_id)
 	starpu_sched_ctx_create_worker_collection(sched_ctx_id, STARPU_WORKER_LIST);
 	struct _starpu_sched_tree *data = malloc(sizeof(struct _starpu_sched_tree));
 	STARPU_PTHREAD_RWLOCK_INIT(&data->lock,NULL);
-	data->root = NULL;
+	struct _starpu_sched_node * ws;
+ 	data->root = ws = _starpu_sched_node_heft_create();
+	data->workers = _starpu_bitmap_create();
+	unsigned i;
+	for(i = 0; i < starpu_worker_get_count(); i++)
+	{
+		struct _starpu_sched_node * node = _starpu_sched_node_worker_get(i);
+		if(!node)
+			continue;
+		struct _starpu_sched_node * fifo = _starpu_sched_node_fifo_create();
+		_starpu_sched_node_add_child(fifo, node);
+		_starpu_sched_node_set_father(node, fifo, sched_ctx_id);
+		
+		_starpu_sched_node_add_child(data->root, fifo);
+		_starpu_sched_node_set_father(fifo, data->root, sched_ctx_id);
+
+	}
+	_starpu_set_workers_bitmaps();
+	_starpu_call_init_data(data);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)data);
+
+
 }
 
 static void deinitialize_heft_center_policy(unsigned sched_ctx_id)
 {
+	struct _starpu_sched_tree *t = (struct _starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
+	_starpu_bitmap_destroy(t->workers);
+	_starpu_tree_destroy(t, sched_ctx_id);
 	starpu_sched_ctx_delete_worker_collection(sched_ctx_id);
 }
 
@@ -168,8 +192,8 @@ struct starpu_sched_policy _starpu_sched_tree_heft_policy =
 {
 	.init_sched = initialize_heft_center_policy,
 	.deinit_sched = deinitialize_heft_center_policy,
-	.add_workers = add_worker_heft,
-	.remove_workers = remove_worker_heft,
+	.add_workers = _starpu_tree_add_workers,
+	.remove_workers = _starpu_tree_remove_workers,
 	.push_task = _starpu_tree_push_task,
 	.pop_task = _starpu_tree_pop_task,
 	.pre_exec_hook = NULL,

+ 1 - 0
src/sched_policies/node_eager.c

@@ -22,6 +22,7 @@ static void initialize_eager_center_policy(unsigned sched_ctx_id)
 		_starpu_sched_node_add_child(data->root, node);
 	}
 	_starpu_set_workers_bitmaps();
+	_starpu_call_init_data(data);
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)data);
 }
 

+ 19 - 6
src/sched_policies/node_fifo.c

@@ -74,9 +74,9 @@ static double estimated_load(struct _starpu_sched_node * node)
 	return load;
 }
 
-static int push_task(struct _starpu_sched_node * node, struct starpu_task * task, struct _starpu_bitmap * worker_mask)
+static int push_task(struct _starpu_sched_node * node, struct starpu_task * task)
 {
-	STARPU_ASSERT(_starpu_sched_node_can_execute_task(node,task, worker_mask));
+	STARPU_ASSERT(_starpu_sched_node_can_execute_task(node,task));
 	struct _starpu_fifo_data * data = node->data;
 	struct _starpu_prio_deque * fifo = &data->fifo;
 	starpu_pthread_mutex_t * mutex = &data->mutex;
@@ -153,6 +153,21 @@ struct starpu_task_list  _starpu_sched_node_fifo_get_non_executable_tasks(struct
 	return list;
 }
 */
+void init_fifo_data(struct _starpu_sched_node * node)
+{
+	STARPU_ASSERT(_starpu_sched_node_is_fifo(node));
+	struct _starpu_fifo_data * data = malloc(sizeof(*data));
+	_starpu_prio_deque_init(&data->fifo);
+	STARPU_PTHREAD_MUTEX_INIT(&data->mutex,NULL);
+	node->data = data;
+}
+void deinit_fifo_data(struct _starpu_sched_node * node)
+{
+	struct _starpu_fifo_data * data = node->data;
+	STARPU_PTHREAD_MUTEX_DESTROY(&data->mutex);
+	_starpu_prio_deque_destroy(&data->fifo);
+	free(data);
+}
 
 
 int _starpu_sched_node_is_fifo(struct _starpu_sched_node * node)
@@ -166,12 +181,10 @@ int _starpu_sched_node_is_fifo(struct _starpu_sched_node * node)
 struct _starpu_sched_node * _starpu_sched_node_fifo_create(void)
 {
 	struct _starpu_sched_node * node = _starpu_sched_node_create();
-	struct _starpu_fifo_data * data = malloc(sizeof(*data));
-	_starpu_prio_deque_init(&data->fifo);
-	STARPU_PTHREAD_MUTEX_INIT(&data->mutex,NULL);
-	node->data = data;
 	node->estimated_execute_preds = estimated_execute_preds;
 	node->estimated_load = estimated_load;
+	node->init_data = init_fifo_data;
+	node->deinit_data = deinit_fifo_data;
 	node->push_task = push_task;
 	node->pop_task = pop_task;
 	return node;

+ 48 - 48
src/sched_policies/node_heft.c

@@ -143,26 +143,6 @@ static void update_helper_node(struct _starpu_sched_node * heft_node)
 }
 */
 
-static void add_child(struct _starpu_sched_node *node,
-		      struct _starpu_sched_node *child,
-		      unsigned sched_ctx_id)
-{
-	_starpu_sched_node_add_child(node,child, sched_ctx_id);
-	struct _starpu_dmda_data * data = node->data;
-	data->no_model_node->add_child(data->no_model_node, child, sched_ctx_id);
-
-}
-static void remove_child(struct _starpu_sched_node *node,
-			 struct _starpu_sched_node *child,
-			 unsigned sched_ctx_id)
-
-{
-	_starpu_sched_node_remove_child(node, child, sched_ctx_id);
-	struct _starpu_dmda_data * data = node->data;
-	data->no_model_node->remove_child(data->no_model_node, child, sched_ctx_id);
-}
-
-
 
 #define _STARPU_SCHED_ALPHA_DEFAULT 1.0
 #define _STARPU_SCHED_BETA_DEFAULT 1.0
@@ -197,22 +177,8 @@ static void param_modified(struct starpu_top_param* d)
 }
 #endif /* !STARPU_USE_TOP */
 
-
-
-static void destroy_heft_node(struct _starpu_sched_node * node)
-{
-	struct _starpu_dmda_data * data = node->data;
-	data->no_model_node->destroy_node(data->no_model_node);
-	_starpu_sched_node_destroy(node);
-	free(data);
-}
-
-struct _starpu_sched_node * _starpu_sched_node_heft_create()
+void init_heft_data(struct _starpu_sched_node *node)
 {
-	double alpha = _STARPU_SCHED_ALPHA_DEFAULT;
-	double beta = _STARPU_SCHED_BETA_DEFAULT;
-	double gamma = _STARPU_SCHED_GAMMA_DEFAULT;
-	double idle_power = 0.0;
 
 	const char *strval_alpha = getenv("STARPU_SCHED_ALPHA");
 	if (strval_alpha)
@@ -224,7 +190,7 @@ struct _starpu_sched_node * _starpu_sched_node_heft_create()
 
 	const char *strval_gamma = getenv("STARPU_SCHED_GAMMA");
 	if (strval_gamma)
-		gamma = atof(strval_gamma);
+		_gamma = atof(strval_gamma);
 
 	const char *strval_idle_power = getenv("STARPU_IDLE_POWER");
 	if (strval_idle_power)
@@ -241,29 +207,63 @@ struct _starpu_sched_node * _starpu_sched_node_heft_create()
 					    idle_power_minimum, idle_power_maximum, param_modified);
 #endif /* !STARPU_USE_TOP */
 
-	struct _starpu_sched_node * node = _starpu_sched_node_create();
-	struct _starpu_dmda_data * data = malloc(sizeof(*data));
 
+	struct _starpu_dmda_data * data = malloc(sizeof(*data));
+	memset(data, 0, sizeof(*data));
 	data->alpha = alpha;
 	data->beta = beta;
-	data->gamma = gamma;
+	data->gamma = _gamma;
 	data->idle_power = idle_power;
 
 	node->data = data;
-	node->push_task = push_task;
-	node->add_child = add_child;
-	node->remove_child = remove_child;
-	node->destroy_node = destroy_heft_node;
 
-	data->no_model_node = _starpu_sched_node_random_create();
+	_starpu_sched_node_heft_set_no_model_node(node, _starpu_sched_node_random_create);
+}
+
+static void destroy_no_model_node(struct _starpu_sched_node * heft_node)
+{
+	struct _starpu_dmda_data * data = heft_node->data;
+	if(data->no_model_node)
+	{
+		data->no_model_node->deinit_data(data->no_model_node);
+		_starpu_sched_node_destroy(data->no_model_node);
+	}
+}
+
+void deinit_heft_data(struct _starpu_sched_node * node)
+{
+	destroy_no_model_node(node);
+	free(node->data);
+}
+
+void _starpu_sched_node_heft_set_no_model_node(struct _starpu_sched_node * heft_node,
+					       struct _starpu_sched_node * (*create_no_model_node)(void))
+{
+	destroy_no_model_node(heft_node);
+	struct _starpu_dmda_data * data = heft_node->data;
+	struct _starpu_sched_node * no_model_node = create_no_model_node();
+	no_model_node->childs = malloc(heft_node->nchilds * sizeof(struct _starpu_sched_node *));
+	memcpy(no_model_node->childs, heft_node->childs, heft_node->nchilds * sizeof(struct _strapu_sched_node *));
+
+	heft_node->childs;
+	no_model_node->nchilds = heft_node->nchilds;
+	no_model_node->init_data(no_model_node);
+	data->no_model_node = no_model_node;
+}
+
+struct _starpu_sched_node * _starpu_sched_node_heft_create()
+{
+
+	struct _starpu_sched_node * node = _starpu_sched_node_create();
+
+	node->push_task = push_task;
+	node->init_data = init_heft_data;
+	node->deinit_data = deinit_heft_data;
 
 	return node;
 }
 
 int _starpu_sched_node_is_heft(struct _starpu_sched_node * node)
 {
-	return node->push_task == push_task
-		|| node->add_child == add_child
-		|| node->remove_child == remove_child
-		|| node->destroy_node == destroy_heft_node;
+	return node->init_data == init_heft_data;
 }

+ 3 - 3
src/sched_policies/node_random.c

@@ -40,7 +40,7 @@ static void deinit_data_random(struct _starpu_sched_node * node)
 	
 }
 
-static int push_task(struct _starpu_sched_node * node, struct starpu_task * task, struct _starpu_bitmap * worker_mask)
+static int push_task(struct _starpu_sched_node * node, struct starpu_task * task)
 {
 	struct _starpu_random_data * rd = node->data;
 
@@ -49,7 +49,7 @@ static int push_task(struct _starpu_sched_node * node, struct starpu_task * task
 	double alpha_sum = 0.0;
 	for(i = 0; i < node->nchilds ; i++)
 	{
-		if(_starpu_sched_node_can_execute_task(node->childs[i],task, worker_mask))
+		if(_starpu_sched_node_can_execute_task(node->childs[i],task))
 		{
 			indexes_nodes[size++] = i;
 			alpha_sum += rd->relative_speedup[i];
@@ -71,7 +71,7 @@ static int push_task(struct _starpu_sched_node * node, struct starpu_task * task
 		alpha += rd->relative_speedup[index];
 	}
 	STARPU_ASSERT(select != NULL);
-	int ret_val = select->push_task(select,task, worker_mask);
+	int ret_val = select->push_task(select,task);
 	node->available(node);
 
 	return ret_val;

+ 14 - 7
src/sched_policies/node_sched.c

@@ -71,7 +71,7 @@ int push_task(struct starpu_task * task)
 	unsigned sched_ctx_id = task->sched_ctx;
 	struct _starpu_sched_tree * t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
 	STARPU_PTHREAD_RWLOCK_RDLOCK(&t->lock);
-	int ret = t->root->push_task(t->root, task, t->workers);
+	int ret = t->root->push_task(t->root, task);
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&t->lock);
 	return ret;
 }
@@ -174,13 +174,18 @@ void _starpu_sched_node_remove_child(struct _starpu_sched_node * node, struct _s
 	node->childs[pos] = node->childs[--node->nchilds];
 }
 
+struct _starpu_bitmap * _starpu_get_worker_mask(struct starpu_task * task)
+{
+	struct _starpu_sched_tree * t = starpu_sched_ctx_get_policy_data(task->sched_ctx);
+	return t->workers;
+}
 
 int _starpu_tree_push_task(struct starpu_task * task)
 {
 	unsigned sched_ctx_id = task->sched_ctx;
 	struct _starpu_sched_tree *tree = starpu_sched_ctx_get_policy_data(sched_ctx_id);
 	STARPU_PTHREAD_RWLOCK_RDLOCK(&tree->lock);
-	int ret_val = tree->root->push_task(tree->root,task,tree->workers);
+	int ret_val = tree->root->push_task(tree->root,task);
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&tree->lock);
 	return ret_val;
 }
@@ -285,10 +290,11 @@ static double estimated_transfer_length(struct _starpu_sched_node * node, struct
 	return sum;
 }
 */
-int _starpu_sched_node_can_execute_task(struct _starpu_sched_node * node, struct starpu_task * task, struct _starpu_bitmap * worker_mask)
+int _starpu_sched_node_can_execute_task(struct _starpu_sched_node * node, struct starpu_task * task)
 {
 	unsigned nimpl;
 	int worker;
+	struct _starpu_bitmap * worker_mask = _starpu_get_worker_mask(task);
 	STARPU_ASSERT(task);
 	STARPU_ASSERT(node);
 	for (nimpl = 0; nimpl < STARPU_MAXIMPLEMENTATIONS; nimpl++)
@@ -302,9 +308,10 @@ int _starpu_sched_node_can_execute_task(struct _starpu_sched_node * node, struct
 	return 0;
 }
 
-int _starpu_sched_node_can_execute_task_with_impl(struct _starpu_sched_node * node, struct starpu_task * task, unsigned nimpl, struct _starpu_bitmap * worker_mask)
+int _starpu_sched_node_can_execute_task_with_impl(struct _starpu_sched_node * node, struct starpu_task * task, unsigned nimpl)
 {
 
+	struct _starpu_bitmap * worker_mask = _starpu_get_worker_mask(task);
 	int worker;
 	STARPU_ASSERT(task);
 	STARPU_ASSERT(nimpl < STARPU_MAXIMPLEMENTATIONS);
@@ -423,12 +430,12 @@ static int push_task_to_first_suitable_parent(struct _starpu_sched_node * node,
 	if(node == NULL || node->fathers[sched_ctx_id] == NULL)
 		return 1;
 
-	struct _starpu_sched_tree *t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
+//	struct _starpu_sched_tree *t = starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
 	
 	struct _starpu_sched_node * father = node->fathers[sched_ctx_id];
-	if(_starpu_sched_node_can_execute_task(father,task,t->workers))
-		return father->push_task(father, task, t->workers);
+	if(_starpu_sched_node_can_execute_task(father,task))
+		return father->push_task(father, task);
 	else
 		return push_task_to_first_suitable_parent(father, task, sched_ctx_id);
 }

+ 14 - 7
src/sched_policies/node_sched.h

@@ -6,8 +6,7 @@
 struct _starpu_sched_node
 {
 	int (*push_task)(struct _starpu_sched_node *,
-			 struct starpu_task *,
-			 struct _starpu_bitmap * sched_ctx_workers_mask);
+			 struct starpu_task *);
 	struct starpu_task * (*pop_task)(struct _starpu_sched_node *,
 					 unsigned sched_ctx_id);
 	void (*available)(struct _starpu_sched_node *);
@@ -39,7 +38,7 @@ struct _starpu_sched_node
 	/* this function is called after all childs has been set
 	 */
 	void (*init_data)(struct _starpu_sched_node *);
-	/* this function is called to free init_data malloc
+	/* this function is called to free data allocated by init_data 
 	 */
 	void (*deinit_data)(struct _starpu_sched_node *);
 
@@ -81,8 +80,6 @@ struct _starpu_sched_tree
  *  .estimated_transfer_length  average transfer cost for all workers in the subtree
  *  .estimated_execution_length average execution cost for all workers in the subtree
  *  .available make a recursive call on childrens
- *  .destroy_node  call _starpu_sched_node_destroy
- *  .{add,remove}_child functions that simply add/remove the child and update the .fathers field of child
  */
 struct _starpu_sched_node * _starpu_sched_node_create(void);
 
@@ -95,8 +92,8 @@ void _starpu_sched_node_add_child(struct _starpu_sched_node* node, struct _starp
 void _starpu_sched_node_remove_child(struct _starpu_sched_node * node, struct _starpu_sched_node * child);
 
 
-int _starpu_sched_node_can_execute_task(struct _starpu_sched_node * node, struct starpu_task * task, struct _starpu_bitmap * worker_mask);
-int _starpu_sched_node_can_execute_task_with_impl(struct _starpu_sched_node * node, struct starpu_task * task, unsigned nimpl, struct _starpu_bitmap * worker_mask);
+int _starpu_sched_node_can_execute_task(struct _starpu_sched_node * node, struct starpu_task * task);
+int _starpu_sched_node_can_execute_task_with_impl(struct _starpu_sched_node * node, struct starpu_task * task, unsigned nimpl);
 
 /* no public create function for workers because we dont want to have several node_worker for a single workerid */
 struct _starpu_sched_node * _starpu_sched_node_worker_get(int workerid);
@@ -118,6 +115,11 @@ struct _starpu_sched_node * _starpu_sched_node_random_create(void);
 struct _starpu_sched_node * _starpu_sched_node_eager_create(void);
 
 struct _starpu_sched_node * _starpu_sched_node_heft_create(void);
+/* this function is called to create the node wich will be used to push task when no perf model are available
+ * by default, a random node is created
+ */
+void _starpu_sched_node_heft_set_no_model_node(struct _starpu_sched_node * heft_node,
+					       struct _starpu_sched_node * (*create_no_model_node)(void));
 
 int _starpu_sched_node_is_heft(struct _starpu_sched_node * node);
 
@@ -140,6 +142,11 @@ void _starpu_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned
 void _starpu_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
 void _starpu_tree_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
 
+/* return the bitmap of worker that are allowed to use in this scheduling context
+ */
+
+struct _starpu_bitmap * _starpu_get_worker_mask(struct starpu_task * task);
+
 /* this function fill all the node->workers member
  */
 void _starpu_set_workers_bitmaps(void);

+ 5 - 2
src/sched_policies/node_work_stealing.c

@@ -126,7 +126,7 @@ static struct starpu_task * pop_task(struct _starpu_sched_node * node, unsigned
 
 
 
-static int push_task(struct _starpu_sched_node * node, struct starpu_task * task, struct _starpu_bitmap * worker_mask)
+static int push_task(struct _starpu_sched_node * node, struct starpu_task * task)
 {
 	struct _starpu_work_stealing_data * wsd = node->data;
 	int ret = -1;
@@ -135,7 +135,7 @@ static int push_task(struct _starpu_sched_node * node, struct starpu_task * task
 	for(i = (start+1)%node->nchilds; i != start; i = (i+1)%node->nchilds)
 	{
 		struct _starpu_sched_node * child = node->childs[i];
-		if(_starpu_sched_node_can_execute_task(child,task, worker_mask))
+		if(_starpu_sched_node_can_execute_task(child,task))
 		{
 			ret = _starpu_fifo_push_sorted_task(wsd->fifos[i], task);
 			break;
@@ -220,6 +220,8 @@ static void deinit_ws_data(struct _starpu_sched_node *node)
 		STARPU_PTHREAD_MUTEX_DESTROY(wsd->mutexes + i);
 		_starpu_destroy_fifo(wsd->fifos[i]);
 	}
+	free(wsd->mutexes);
+	free(wsd->fifos);
 	free(wsd);
 	node->data = NULL;
 }
@@ -267,6 +269,7 @@ static void initialize_ws_center_policy(unsigned sched_ctx_id)
 static void deinitialize_ws_center_policy(unsigned sched_ctx_id)
 {
 	struct _starpu_sched_tree *t = (struct _starpu_sched_tree*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
+	_starpu_bitmap_destroy(t->workers);
 	_starpu_tree_destroy(t, sched_ctx_id);
 	starpu_sched_ctx_delete_worker_collection(sched_ctx_id);
 }

+ 1 - 1
src/sched_policies/node_worker.c

@@ -18,7 +18,7 @@ struct _starpu_sched_node * _starpu_sched_node_worker_get(int workerid)
 
 
 
-int _starpu_sched_node_worker_push_task(struct _starpu_sched_node * node, struct starpu_task *task, struct _starpu_bitmap * worker_mask STARPU_ATTRIBUTE_UNUSED)
+int _starpu_sched_node_worker_push_task(struct _starpu_sched_node * node, struct starpu_task *task)
 {
 	/*this function take the worker's mutex */