I have some recipes, that took quite long to cook, for example 8 hours. I want to start cooking those in the morning, so it is ready after I come from work in the evening. Is it safe to cook it on the gas? I put it on the smallest flame, so the amount of gas is very low. Are there generally any risks of some accident, or is the amount of gas so low, that when I open a window, the gas will be dissolved (in case that it would stop burning at some point in the process of cooking)?
Assuming your're talking about natural gas (methane) then unlike some other gases such as LPG it is less dense than air and will tend to float up. While in the case of a leak much would probably go out the window I wouldn't consider leaving it unattended 100% safe and can think of a few situations that could occur:
Instead I'd probably go with a slow cooker as a few people have suggested in comments. It will vary by brand / size but my slow cooker uses 120 watts on the low setting. Over the eight hours of cooking that would use around 1kWh of power, costing under 20 cents for most of the United States so they are quite economical as well.