How can i do something like multi threathing in arduino?

Robin2:
Keep it simple. Have a look at the demo Several Things at a Time

Or you can do it the complicated way, which turns out to be simpler in the long run.

I like to organise my code into objects, each of which has a setup() and loop() method. Pin assignments are done in the constructor, and the main sketch setup and loop calls the setup and loop of each object (several ways of organising this). Each object does its own thing with the pins it owns an its own internal state. Communication between objects can be done statically or by references that are passed into the constructor.