Can you explain the difference between a process and a thread in a Linux environment?
For a hands-on version, group Linux task records by their thread-group ID, or tgid, and distinguish the process leader from its threads. Implement group_linux_tasks(tasks), which accepts a list of dictionaries containing integer pid and tgid values and returns groups sorted by tgid.
def group_linux_tasks(tasks):