Is thread in operating system = thread function in programming languages?
because there is only one main function, usually the program would just run from top of the main function to down.


That's a long way from being the case. Loops, conditional statements and function calls mean that the control flow of any non-trivial program is much more complex than just running from the top of main() to the bottom.


  
  Is thread in operating system = function in programming language?
  


No. A thread is, essentially, a subprocess. A process may have several threads, and each of these threads executes semi-independently while sharing some common information. A function, on the other hand, is typically a somewhat self-contained unit of work.

An analogy might be that a process is like a company (there can be many different processes, they're kept separate from each other but they can arrange to cooperate with each other in various ways, governed by the law of the country they're in), a thread is like an employee of a company (employees share access to the company's resources and cooperate closely under rules defined by the company) and a function is a specific task that might be performed by an employee (making coffee, typing a letter, attaching a door to a car, etc.)


  
  Is function in programming language = thread function in programming language?
  Is thread in operating system = thread function in programming language?
  


The things you're calling "thread functions" are just programming language libraries that access the operating system's interface for creating and managing threads


  
  Thread function allows multiple functions to be performed simultaneously, like having multiple main functions. Is this correct?
  


Well, threads allow multiple functions to be performed simultaneously. main() is just the entry point to the program as a whole: it's the place where execution starts.


  
  Where is thread written in operating system/ programming language?
  


I'm not sure what you mean by this but it's going to depend on the OS and programming language in question.


  
  Will the program not be able to do multithreading if it doesn't include these thread functions?
  


A program will need some way of telling the operating system to make a new thread. In practical terms, using a library that somebody has already written is going to be more convenient than trying to manage the interaction with the operating system yourself.