# Nanos and Threads

**URL:** <https://forums.nanovms.com/t/nanos-and-threads/56>\
**Category:** Uncategorized\
**Created:** [October 3, 2024, 2:58pm UTC](https://forums.nanovms.com/t/nanos-and-threads/56 "2024-10-03T14:58:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itzpires](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@itzpires](https://forums.nanovms.com/u/itzpires)\
**Post date:** [October 3, 2024, 2:58pm UTC](https://forums.nanovms.com/t/nanos-and-threads/56/1 "2024-10-03T14:58:10Z")

</div>

Good afternoon, I hope everyone is well.  
Nanos is multi-threaded. However, it can’t create threads with pthread\_create. Does the thread implementation method use anything specific?  
Thank you very much!

```auto
samuel@samuel-virtual-machine:~/Desktop/Apps/jitterdebugger$ ops run jitterdebugger
running local instance
booting /home/samuel/.ops/images/jitterdebugger ...
en1: assigned 10.0.2.15
affinity: 0 = 1 [0x1]
jitterdebugger.c:start_measuring(): pthread_create(): Function not implemented

```

---

<div class="post-metadata">

**Author:** ![eyberg](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@eyberg](https://forums.nanovms.com/u/eyberg)\
**Post date:** [October 3, 2024, 4:09pm UTC](https://forums.nanovms.com/t/nanos-and-threads/56/2 "2024-10-03T16:09:21Z")

</div>

Yes it can. There is nothing specific. You can try this example out: [A Simple Pthread example · GitHub](https://gist.github.com/ankurs/179778) .

I took a quick look at jitterdebugger and you are more than likely running into the fact that it forks in a few places - those would need to be patched for it to work as we explicitly do not support fork/exec on purpose.

---

<div class="post-metadata">

**Author:** ![itzpires](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@itzpires](https://forums.nanovms.com/u/itzpires)\
**Post date:** [October 9, 2024, 3:32pm UTC](https://forums.nanovms.com/t/nanos-and-threads/56/3 "2024-10-09T15:32:29Z")

</div>

It’s working! Thank you very much!  
It turns out that in the Jitterdebugger version, pthread\_create receives the arguments, &attr, where they come with errors and Nanos can’t resolve them, different from linux and so on. If you set it to NULL, it works!

```auto
// old
err = pthread_create(&s[i].pid, &attr, &worker, &s[i]);

// new
err = pthread_create(&s[i].pid, NULL, &worker, &s[i]);

```

Thank you! With respect to the forks, this has been controlled and avoided. Thank you!
