According to the USCIS, the application for a green card can take 7 months to 33 months to process.
1 replyTo remain in the US legally, you will have to maintain the status of the visa, that is, stay working and get paid. If your job ends, you are not maintaining the status.
After which, you will get a 60-day grace period to either get another job, change your status, or depart the US. You will also have to actively look for a job, show that you have submitted applications, and are corresponding with prospective employers to get the full 60-day grace period.